/* 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/. */ "use strict"; const { Ci, Cu } = require("chrome"); const ChromeUtils = require("ChromeUtils"); const Services = require("Services"); const { BrowserElementWebNavigation } = require("./web-navigation"); const { getStack } = require("devtools/shared/platform/stack"); // A symbol used to hold onto the frame loader from the outer browser while tunneling. const FRAME_LOADER = Symbol("devtools/responsive/frame-loader"); // Export for use in tests. exports.OUTER_FRAME_LOADER_SYMBOL = FRAME_LOADER; function debug(msg) { // console.log(msg); } /** * Properties swapped between browsers by browser.js's `swapDocShells`. */ const SWAPPED_BROWSER_STATE = [ "_remoteFinder", "_securityUI", "_documentURI", "_documentContentType", "_contentTitle", "_characterSet", "_contentPrincipal", "_imageDocument", "_isSyntheticDocument", "_innerWindowID", ]; /** * Various parts of the Firefox code base expect to access properties on the browser * window in response to events (by reaching for the window via the event's target). * * When RDM is enabled, these bits of code instead reach the RDM tool's window instead of * the browser window, which won't have the properties they are looking for. At the * moment, we address this by exposing them from the browser window on RDM's window as * needed. */ const PROPERTIES_FROM_BROWSER_WINDOW = [ // This is used by PermissionUI.jsm for permission doorhangers. "PopupNotifications", // These are used by ContentClick.jsm when opening links in ways other than just // navigating the viewport, such as a new tab by pressing Cmd-Click. "whereToOpenLink", "openLinkIn", // This is used by various event handlers, typically to call `getTabForBrowser` to map // a browser back to a tab. "gBrowser", ]; /** * This module takes an "outer" from a browser tab as described by * Firefox's tabbrowser.xml and wires it up to an "inner"