mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Bug 1731548 - [remote] Cache innerWindowId on WindowGlobalMessageHandler. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D132060
This commit is contained in:
parent
b5283b0fef
commit
809bd45036
@ -25,6 +25,14 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
* MessageHandler network.
|
||||
*/
|
||||
class WindowGlobalMessageHandler extends MessageHandler {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
// Bug 1743083: Temporarily delay caching of the inner window id until
|
||||
// the session data is no longer applied before super() returns.
|
||||
this._innerWindowId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the WindowGlobalMessageHandler module path.
|
||||
*
|
||||
@ -57,6 +65,14 @@ class WindowGlobalMessageHandler extends MessageHandler {
|
||||
return context.id;
|
||||
}
|
||||
|
||||
get innerWindowId() {
|
||||
if (this._innerWindowId === undefined) {
|
||||
this._innerWindowId = this._context.window.windowGlobalChild.innerWindowId;
|
||||
}
|
||||
|
||||
return this._innerWindowId;
|
||||
}
|
||||
|
||||
forwardCommand(command) {
|
||||
throw new Error(
|
||||
`Cannot forward commands from a "WINDOW_GLOBAL" MessageHandler`
|
||||
|
@ -54,12 +54,9 @@ class Log extends Module {
|
||||
}
|
||||
|
||||
_onConsoleAPILogEvent(message) {
|
||||
const browsingContext = BrowsingContext.get(this.messageHandler.contextId);
|
||||
const innerWindowId =
|
||||
browsingContext.window.windowGlobalChild?.innerWindowId;
|
||||
|
||||
const messageObject = message.wrappedJSObject;
|
||||
if (innerWindowId !== messageObject.innerID) {
|
||||
|
||||
if (messageObject.innerID !== this.messageHandler.innerWindowId) {
|
||||
// If the message doesn't match the innerWindowId of the current context
|
||||
// ignore it.
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user