diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /mobile/android/modules/geckoview/GeckoViewActorChild.jsm | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/modules/geckoview/GeckoViewActorChild.jsm')
-rw-r--r-- | mobile/android/modules/geckoview/GeckoViewActorChild.jsm | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mobile/android/modules/geckoview/GeckoViewActorChild.jsm b/mobile/android/modules/geckoview/GeckoViewActorChild.jsm new file mode 100644 index 0000000000..8f80039353 --- /dev/null +++ b/mobile/android/modules/geckoview/GeckoViewActorChild.jsm @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { GeckoViewUtils } = ChromeUtils.import( + "resource://gre/modules/GeckoViewUtils.jsm" +); + +var EXPORTED_SYMBOLS = ["GeckoViewActorChild"]; + +class GeckoViewActorChild extends JSWindowActorChild { + static initLogging(aModuleName) { + const tag = aModuleName.replace("GeckoView", "") + "[C]"; + return GeckoViewUtils.initLogging(tag); + } + + actorCreated() { + this.eventDispatcher = GeckoViewUtils.getDispatcherForWindow( + this.docShell.domWindow + ); + } + + /** Returns true if this docShell is of type Content, false otherwise. */ + get isContentWindow() { + if (!this.docShell) { + return false; + } + + // Some WebExtension windows are tagged as content but really they are not + // for us (e.g. the remote debugging window or the background extension + // page). + const browser = this.browsingContext.top.embedderElement; + if (browser) { + const viewType = browser.getAttribute("webextension-view-type"); + if (viewType) { + debug`webextension-view-type: ${viewType}`; + return false; + } + const debugTarget = browser.getAttribute( + "webextension-addon-debug-target" + ); + if (debugTarget) { + debug`webextension-addon-debug-target: ${debugTarget}`; + return false; + } + } + + return this.docShell.itemType == this.docShell.typeContent; + } +} + +const { debug, warn } = GeckoViewUtils.initLogging("Actor[C]"); |