-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#6649: Avoid background messaging to handle AJAX page updates #7030
Changes from 1 commit
384fb0f
41884b4
531675f
b5f022d
d44fb9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { reactivateTab, handleNavigate } from "@/contentScript/messenger/api"; | ||
import { reactivateTab } from "@/contentScript/messenger/api"; | ||
import { forEachTab } from "@/utils/extensionUtils"; | ||
import { type Target } from "@/types/messengerTypes"; | ||
import { canAccessTab } from "@/permissions/permissionsUtils"; | ||
|
@@ -51,12 +51,6 @@ async function onNavigation({ tabId, frameId }: Target): Promise<void> { | |
if (syncFlagOn("navigation-trace")) { | ||
await traceNavigation({ tabId, frameId }); | ||
} | ||
|
||
if (await canAccessTab({ tabId, frameId })) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that messaging + this check added at least 100ms to the navigation event. |
||
// The content script will already be injected, so we don't have to call ensureContentScript before messaging the | ||
// content script with handleNavigate. | ||
handleNavigate({ tabId, frameId }); | ||
} | ||
} | ||
|
||
// Some sites use the hash to encode page state (e.g., filters). There are some non-navigation scenarios where the hash | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import registerMessenger from "@/contentScript/messenger/registration"; | |
import registerBuiltinBlocks from "@/bricks/registerBuiltinBlocks"; | ||
import registerContribBlocks from "@/contrib/registerContribBlocks"; | ||
import brickRegistry from "@/bricks/registry"; | ||
import { handleNavigate } from "@/contentScript/lifecycle"; | ||
import { handleNavigate, initNavigation } from "@/contentScript/lifecycle"; | ||
import { initTelemetry } from "@/background/messenger/api"; | ||
import { ENSURE_CONTENT_SCRIPT_READY } from "@/contentScript/ready"; | ||
import { initToaster } from "@/utils/notify"; | ||
|
@@ -66,6 +66,7 @@ export async function init(): Promise<void> { | |
initToaster(); | ||
|
||
await handleNavigate(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we comment on the ordering here? I.e., why is initNavigation after handleNavigate. I think the answer is just: "handle initial load, then watch for additional navigation events" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #7178 |
||
initNavigation(); | ||
|
||
void initSidebarActivation(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not removed the listeners due to this logging.
What would you like to do?
addAuthListener
), instead of checking the flag at every navigationThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets do this. Unfortunately navigation tracing code is still helpful to understand wacky SPA navigation behavior of some in-house applications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #7178