From a36bb7751f128a0827b3be37afe650d5aba248ae Mon Sep 17 00:00:00 2001 From: Razvan Maries Date: Mon, 1 Jun 2020 23:51:35 +0300 Subject: [PATCH] Backed out 3 changesets (bug 1638153) for perma failures on cross-origin-objects.html. CLOSED TREE Backed out changeset f7aedc92d396 (bug 1638153) Backed out changeset 07ec713926c6 (bug 1638153) Backed out changeset 5a656842e241 (bug 1638153) --- accessible/tests/mochitest/browser.js | 2 +- accessible/tests/mochitest/common.js | 2 +- .../events/docload/test_docload_root.html | 2 +- .../events/docload/test_docload_shutdown.html | 2 +- .../tests/mochitest/focus/test_focusedChild.html | 2 +- browser/base/content/browser.js | 2 +- browser/base/content/sanitizeDialog.js | 4 +++- .../components/downloads/DownloadsTaskbar.jsm | 4 +++- browser/components/preferences/main.js | 4 ++-- browser/components/preferences/preferences.js | 2 +- browser/components/preferences/sync.js | 8 +++----- .../sessionstore/content/aboutSessionRestore.js | 2 +- browser/components/syncedtabs/util.js | 2 +- browser/modules/SiteDataManager.jsm | 2 +- devtools/client/framework/devtools-browser.js | 2 +- devtools/client/responsive/utils/window.js | 2 +- docshell/base/BrowsingContext.h | 1 - docshell/base/CanonicalBrowsingContext.cpp | 12 ------------ docshell/base/CanonicalBrowsingContext.h | 2 -- docshell/test/chrome/test_bug608669.xhtml | 2 +- docshell/test/chrome/test_principalInherit.xhtml | 2 +- .../test/chrome/test_chromeOuterWindowID.xhtml | 2 +- .../chrome/test_document-element-inserted.xhtml | 2 +- dom/base/test/test_bug1016960.html | 2 +- dom/bindings/Codegen.py | 4 +--- .../chrome/test_drawWindow_widget_layers.html | 4 ++-- dom/chrome-webidl/BrowsingContext.webidl | 2 -- dom/events/test/test_bug1412775.xhtml | 2 +- dom/events/test/test_bug617528.xhtml | 2 +- dom/ipc/remote-test.js | 4 +--- dom/ipc/tests/test_process_error.xhtml | 2 +- dom/ipc/tests/test_process_error_oom.xhtml | 2 +- .../mochitest/test_privatemode_perwindowpb.xhtml | 2 +- .../test_xulbrowser_plugin_visibility.xhtml | 2 +- .../test/test_privateBrowsing.html | 2 +- .../mochitest/beacon/test_beaconCookies.html | 2 +- .../chrome/test_MozDomFullscreen_event.xhtml | 2 +- dom/tests/mochitest/chrome/test_activation.xhtml | 2 +- .../mochitest/chrome/test_docshell_swap.xhtml | 4 ++-- dom/tests/mochitest/chrome/test_fullscreen.xhtml | 2 +- .../chrome/test_sizemode_attribute.xhtml | 2 +- dom/tests/mochitest/chrome/window_focus.xhtml | 2 +- .../mochitest/keyhandling/test_windowed.xhtml | 2 +- ...alStorageBasePrivateBrowsing_perwindowpb.html | 2 +- ...lStorageQuotaPrivateBrowsing_perwindowpb.html | 2 +- dom/webidl/Window.webidl | 3 --- .../test/test_sharedWorker_privateBrowsing.html | 2 +- dom/xul/test/test_bug583948.xhtml | 2 +- dom/xul/test/test_bug757137.xhtml | 2 +- editor/spellchecker/tests/test_bug1209414.html | 3 ++- .../test/browser/browser_docshell_type_editor.js | 14 ++++++++------ image/test/mochitest/test_bug1132427.html | 11 ++++------- js/xpconnect/tests/chrome/test_bug1124898.html | 2 +- js/xpconnect/tests/chrome/test_bug503926.xhtml | 2 +- layout/base/tests/chrome/test_bug458898.html | 2 +- .../chrome/test_css_visibility_propagation.xhtml | 4 ++-- .../forms/test/test_bug536567_perwindowpb.html | 2 +- layout/forms/test/test_bug665540.html | 2 +- layout/xul/test/test_windowminmaxsize.xhtml | 4 ++-- mobile/android/components/extensions/ext-tabs.js | 2 +- .../manager/pki/resources/content/certManager.js | 6 +++--- .../pki/resources/content/device_manager.js | 4 ++-- security/manager/pki/resources/content/pippki.js | 2 +- .../test_sts_privatebrowsing_perwindowpb.html | 2 +- .../specialpowers/content/SpecialPowersChild.jsm | 2 +- .../aboutmemory/tests/test_aboutmemory5.xhtml | 2 +- .../tests/test_dumpGCAndCCLogsToFile.xhtml | 2 +- .../tests/test_memoryReporters2.xhtml | 2 +- .../components/extensions/ExtensionParent.jsm | 2 +- .../test_browser_disableglobalhistory.xhtml | 2 +- .../tests/mochitest/test_advisory_link.html | 2 +- .../mochitest/test_classified_annotations.html | 2 +- .../test_classifier_changetablepref.html | 2 +- .../tests/mochitest/test_donottrack.html | 2 +- .../test_privatebrowsing_trackingprotection.html | 2 +- .../tests/mochitest/test_reporturl.html | 2 +- .../tests/mochitest/test_threathit_report.html | 2 +- .../test_trackingprotection_bug1157081.html | 2 +- .../test_trackingprotection_bug1312515.html | 2 +- .../test_trackingprotection_bug1580416.html | 2 +- .../test_trackingprotection_whitelist.html | 2 +- .../test/test_dialog_arguments.html | 2 +- toolkit/content/aboutProfiles.js | 2 +- toolkit/content/aboutSupport.js | 2 +- toolkit/content/aboutTelemetry.js | 2 +- .../content/tests/chrome/test_browser_drop.xhtml | 2 +- .../content/tests/chrome/test_bug624329.xhtml | 2 +- .../content/tests/chrome/test_dialogfocus.xhtml | 2 +- .../tests/chrome/test_edit_contextmenu.html | 2 +- .../tests/chrome/test_maximized_persist.xhtml | 2 +- .../tests/chrome/test_navigate_persist.html | 4 ++-- .../content/tests/chrome/test_preferences.xhtml | 16 ++++++++-------- .../chrome/test_preferences_beforeaccept.xhtml | 2 +- .../test_preferences_onsyncfrompreference.xhtml | 2 +- .../tests/chrome/test_screenPersistence.xhtml | 4 ++-- .../content/tests/chrome/test_showcaret.xhtml | 2 +- .../chrome/test_window_intrinsic_size.xhtml | 2 +- toolkit/modules/ResetProfile.jsm | 2 +- toolkit/mozapps/downloads/HelperAppDlg.jsm | 2 +- .../mozapps/handling/ContentDispatchChooser.jsm | 2 +- widget/tests/test_bug1123480.xhtml | 2 +- widget/tests/test_bug538242.xhtml | 2 +- widget/tests/test_bug593307.xhtml | 2 +- widget/tests/test_bug596600.xhtml | 4 ++-- widget/tests/test_chrome_context_menus_win.xhtml | 2 +- .../test_input_events_on_deactive_window.xhtml | 2 +- widget/tests/test_picker_no_crash.html | 2 +- widget/tests/test_position_on_resize.xhtml | 2 +- widget/tests/test_secure_input.html | 2 +- widget/tests/test_sizemode_events.xhtml | 2 +- widget/tests/test_transferable_overflow.xhtml | 2 +- widget/tests/window_bug429954.xhtml | 2 +- 112 files changed, 142 insertions(+), 164 deletions(-) diff --git a/accessible/tests/mochitest/browser.js b/accessible/tests/mochitest/browser.js index ffe67b0ed0db..74256d434059 100644 --- a/accessible/tests/mochitest/browser.js +++ b/accessible/tests/mochitest/browser.js @@ -121,7 +121,7 @@ function openBrowserWindowIntl() { } } - gBrowserContext.browserWnd = window.browsingContext.topChromeWindow.openDialog( + gBrowserContext.browserWnd = window.docShell.rootTreeItem.domWindow.openDialog( AppConstants.BROWSER_CHROME_URL, "_blank", params, diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index eed579cc0aa2..54125a80a575 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -992,7 +992,7 @@ function shortenString(aString, aMaxLength) { * Return main chrome window (crosses chrome boundary) */ function getMainChromeWindow(aWindow) { - return aWindow.browsingContext.topChromeWindow; + return aWindow.docShell.rootTreeItem.domWindow; } /** Sets the test plugin(s) initially expected enabled state. diff --git a/accessible/tests/mochitest/events/docload/test_docload_root.html b/accessible/tests/mochitest/events/docload/test_docload_root.html index 7947327c2805..2cf6d3e84fa1 100644 --- a/accessible/tests/mochitest/events/docload/test_docload_root.html +++ b/accessible/tests/mochitest/events/docload/test_docload_root.html @@ -43,7 +43,7 @@ new invokerChecker(EVENT_FOCUS, () => gDialog.document) ]; - this.invoke = () => (gDialog = window.browsingContext.topChromeWindow.openDialog(aURL)); + this.invoke = () => (gDialog = window.docShell.rootTreeItem.domWindow.openDialog(aURL)); this.finalCheck = () => { const accTree = { diff --git a/accessible/tests/mochitest/events/docload/test_docload_shutdown.html b/accessible/tests/mochitest/events/docload/test_docload_shutdown.html index 5838b80083bc..38171fc4d69c 100644 --- a/accessible/tests/mochitest/events/docload/test_docload_shutdown.html +++ b/accessible/tests/mochitest/events/docload/test_docload_shutdown.html @@ -54,7 +54,7 @@ ]; - this.invoke = () => gDialog = window.browsingContext.topChromeWindow.openDialog(aURL); + this.invoke = () => gDialog = window.docShell.rootTreeItem.domWindow.openDialog(aURL); this.finalCheck = () => { const accTree = { diff --git a/accessible/tests/mochitest/focus/test_focusedChild.html b/accessible/tests/mochitest/focus/test_focusedChild.html index d12e229b4821..ff40204f0351 100644 --- a/accessible/tests/mochitest/focus/test_focusedChild.html +++ b/accessible/tests/mochitest/focus/test_focusedChild.html @@ -24,7 +24,7 @@ this) ]; this.invoke = function openWnd_invoke() { - this.dialog = window.browsingContext.topChromeWindow + this.dialog = window.docShell.rootTreeItem.domWindow .openDialog("about:mozilla", "AboutMozilla", "chrome,width=600,height=600"); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 5e2f39e16e4b..a59c4921aed3 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -7985,7 +7985,7 @@ function BrowserOpenAddonsMgr(aView) { let browserWindow; var receivePong = function(aSubject, aTopic, aData) { - let browserWin = aSubject.browsingContext.topChromeWindow; + let browserWin = aSubject.docShell.rootTreeItem.domWindow; if (!emWindow || browserWin == window /* favor the current window */) { emWindow = aSubject; browserWindow = browserWin; diff --git a/browser/base/content/sanitizeDialog.js b/browser/base/content/sanitizeDialog.js index 21094f6e3beb..273374d53216 100644 --- a/browser/base/content/sanitizeDialog.js +++ b/browser/base/content/sanitizeDialog.js @@ -57,7 +57,9 @@ var gSanitizePromptDialog = { .translateFragment(warningDesc) .then(() => { // And then ensure we've run layout. - let rootWin = window.browsingContext.topChromeWindow; + let rootWin = window.docShell.rootTreeItem.QueryInterface( + Ci.nsIDocShell + ).domWindow; return rootWin.promiseDocumentFlushed(() => {}); }); } else { diff --git a/browser/components/downloads/DownloadsTaskbar.jsm b/browser/components/downloads/DownloadsTaskbar.jsm index 0096ebcafbfb..380c4c679178 100644 --- a/browser/components/downloads/DownloadsTaskbar.jsm +++ b/browser/components/downloads/DownloadsTaskbar.jsm @@ -129,7 +129,9 @@ var DownloadsTaskbar = { */ _attachIndicator(aWindow) { // Activate the indicator on the specified window. - let { docShell } = aWindow.browsingContext.topChromeWindow; + let docShell = aWindow.docShell.treeOwner + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIAppWindow).docShell; this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell); // If the DownloadSummary object has already been created, we should update diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js index e988df8c01e7..9f36871d6303 100644 --- a/browser/components/preferences/main.js +++ b/browser/components/preferences/main.js @@ -955,7 +955,7 @@ var gMainPane = { * changes. */ async initDefaultZoomValues() { - let win = window.browsingContext.topChromeWindow; + let win = window.docShell.rootTreeItem.domWindow; let selected = await win.ZoomUI.getGlobalValue(); let menulist = document.getElementById("defaultZoom"); @@ -1183,7 +1183,7 @@ var gMainPane = { * to set the property, regardless of our actual context. */ - let win = window.browsingContext.topChromeWindow; + let win = window.docShell.rootTreeItem.domWindow; cps2.setGlobal(win.FullZoom.name, newZoom, nonPrivateLoadContext); }, diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js index b3037ca5dae7..27e9763a1f9e 100644 --- a/browser/components/preferences/preferences.js +++ b/browser/components/preferences/preferences.js @@ -122,7 +122,7 @@ function init_all() { // Ignore right clicks. return; } - let mainWindow = window.browsingContext.topChromeWindow; + let mainWindow = window.docShell.rootTreeItem.domWindow; mainWindow.BrowserOpenAddonsMgr(); AMTelemetry.recordLinkEvent({ object: "aboutPreferences", diff --git a/browser/components/preferences/sync.js b/browser/components/preferences/sync.js index 171813200373..6418e4dbec9f 100644 --- a/browser/components/preferences/sync.js +++ b/browser/components/preferences/sync.js @@ -268,7 +268,7 @@ var gSyncPane = { // button label (ie, "Syncing...") let tooltiptext = state.syncing ? document.getElementById("syncNow").getAttribute("label") - : window.browsingContext.topChromeWindow.gSync.formatLastSyncDate( + : window.docShell.rootTreeItem.domWindow.gSync.formatLastSyncDate( state.lastSync ); document @@ -552,14 +552,12 @@ var gSyncPane = { // Disconnect the account, including everything linked. unlinkFirefoxAccount(confirm) { - window.browsingContext.topChromeWindow.gSync.disconnect({ - confirm, - }); + window.docShell.rootTreeItem.domWindow.gSync.disconnect({ confirm }); }, // Disconnect sync, leaving the account connected. disconnectSync() { - return window.browsingContext.topChromeWindow.gSync.disconnect({ + return window.docShell.rootTreeItem.domWindow.gSync.disconnect({ confirm: true, disconnectAccount: false, }); diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js index 573a51964ad5..7e4eef575b17 100644 --- a/browser/components/sessionstore/content/aboutSessionRestore.js +++ b/browser/components/sessionstore/content/aboutSessionRestore.js @@ -276,7 +276,7 @@ function onListKeyDown(aEvent) { // Helper functions function getBrowserWindow() { - return window.browsingContext.topChromeWindow; + return window.docShell.rootTreeItem.domWindow; } function toggleRowChecked(aIx) { diff --git a/browser/components/syncedtabs/util.js b/browser/components/syncedtabs/util.js index 2d2ef7645e77..d6529c3cd823 100644 --- a/browser/components/syncedtabs/util.js +++ b/browser/components/syncedtabs/util.js @@ -8,5 +8,5 @@ var EXPORTED_SYMBOLS = ["getChromeWindow"]; // Get the chrome (ie, browser) window hosting this content. function getChromeWindow(window) { - return window.browsingContext.topChromeWindow; + return window.docShell.rootTreeItem.domWindow.wrappedJSObject; } diff --git a/browser/modules/SiteDataManager.jsm b/browser/modules/SiteDataManager.jsm index d13354535716..ae6750129eaa 100644 --- a/browser/modules/SiteDataManager.jsm +++ b/browser/modules/SiteDataManager.jsm @@ -512,7 +512,7 @@ var SiteDataManager = { allowed: false, }; let features = "centerscreen,chrome,modal,resizable=no"; - win.browsingContext.topChromeWindow.openDialog( + win.docShell.rootTreeItem.domWindow.openDialog( "chrome://browser/content/preferences/dialogs/siteDataRemoveSelected.xhtml", "", features, diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js index d13e671342e7..d1f68fafd281 100644 --- a/devtools/client/framework/devtools-browser.js +++ b/devtools/client/framework/devtools-browser.js @@ -521,7 +521,7 @@ var gDevToolsBrowser = (exports.gDevToolsBrowser = { } debugService.activationHandler = function(window) { - const chromeWindow = window.browsingContext.topChromeWindow; + const chromeWindow = window.docShell.rootTreeItem.domWindow; let setupFinished = false; slowScriptDebugHandler(chromeWindow.gBrowser.selectedTab, () => { diff --git a/devtools/client/responsive/utils/window.js b/devtools/client/responsive/utils/window.js index 927ff8570c8c..3435216b4877 100644 --- a/devtools/client/responsive/utils/window.js +++ b/devtools/client/responsive/utils/window.js @@ -10,7 +10,7 @@ const Services = require("Services"); * Returns the `nsIDOMWindow` toplevel window for any child/inner window */ function getTopLevelWindow(window) { - return window.browsingContext.topChromeWindow; + return window.docShell.rootTreeItem.domWindow; } exports.getTopLevelWindow = getTopLevelWindow; diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h index 0dab11549db3..32c4494dc7fa 100644 --- a/docshell/base/BrowsingContext.h +++ b/docshell/base/BrowsingContext.h @@ -507,7 +507,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { // Window APIs that are cross-origin-accessible (from the HTML spec). WindowProxyHolder Window(); - BrowsingContext* GetBrowsingContext() { return this; }; BrowsingContext* Self() { return this; } void Location(JSContext* aCx, JS::MutableHandle aLocation, ErrorResult& aError); diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index cb6851a419f6..cb398db67946 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -205,18 +205,6 @@ CanonicalBrowsingContext::GetParentCrossChromeBoundary() { return nullptr; } -Nullable CanonicalBrowsingContext::GetTopChromeWindow() { - RefPtr bc(this); - while (RefPtr parent = - bc->GetParentCrossChromeBoundary()) { - bc = parent.forget(); - } - if (bc->IsChrome()) { - return WindowProxyHolder(bc.forget()); - } - return nullptr; -} - nsISHistory* CanonicalBrowsingContext::GetSessionHistory() { if (!IsTop()) { return Cast(Top())->GetSessionHistory(); diff --git a/docshell/base/CanonicalBrowsingContext.h b/docshell/base/CanonicalBrowsingContext.h index b00d2893b195..1bf569a77c1a 100644 --- a/docshell/base/CanonicalBrowsingContext.h +++ b/docshell/base/CanonicalBrowsingContext.h @@ -94,8 +94,6 @@ class CanonicalBrowsingContext final : public BrowsingContext { already_AddRefed GetParentCrossChromeBoundary(); - Nullable GetTopChromeWindow(); - nsISHistory* GetSessionHistory(); UniquePtr CreateSessionHistoryEntryForLoad( nsDocShellLoadState* aLoadState, nsIChannel* aChannel); diff --git a/docshell/test/chrome/test_bug608669.xhtml b/docshell/test/chrome/test_bug608669.xhtml index 16150eaa8739..8a34311700a3 100644 --- a/docshell/test/chrome/test_bug608669.xhtml +++ b/docshell/test/chrome/test_bug608669.xhtml @@ -28,7 +28,7 @@ function nextTest() { gen.next(); } -let chromeWindow = window.browsingContext.topChromeWindow; +let chromeWindow = docShell.rootTreeItem.domWindow; function* doTest() { var notificationCount = 0; diff --git a/docshell/test/chrome/test_principalInherit.xhtml b/docshell/test/chrome/test_principalInherit.xhtml index f17fdf4b746c..da010e2f989b 100644 --- a/docshell/test/chrome/test_principalInherit.xhtml +++ b/docshell/test/chrome/test_principalInherit.xhtml @@ -61,7 +61,7 @@ var tests = [ // force creation of a content viewer. let xulWinURL = 'data:application/xhtml+xml,' + ''; - let newWin = window.browsingContext.topChromeWindow.openDialog(xulWinURL, "chrome_window", "chrome"); + let newWin = docShell.rootTreeItem.domWindow.openDialog(xulWinURL, "chrome_window", "chrome"); loadListener(newWin, function () { let frame = newWin.document.createXULElement("iframe"); frame.setAttribute("type", "content"); diff --git a/dom/base/test/chrome/test_chromeOuterWindowID.xhtml b/dom/base/test/chrome/test_chromeOuterWindowID.xhtml index 13eba45152c3..c6383d64c29a 100644 --- a/dom/base/test/chrome/test_chromeOuterWindowID.xhtml +++ b/dom/base/test/chrome/test_chromeOuterWindowID.xhtml @@ -72,7 +72,7 @@ windows. * nonRemote: a reference to the non-remote browser in the window */ async function prepareWindow(num, page) { - let win = window.browsingContext.topChromeWindow.open(BROWSER_DOC, "bug1474662-" + num, "chrome,width=200,height=200"); + let win = docShell.rootTreeItem.domWindow.open(BROWSER_DOC, "bug1474662-" + num, "chrome,width=200,height=200"); await BrowserTestUtils.waitForEvent(win, "load"); let remote = win.document.getElementById("remote"); let nonRemote = win.document.getElementById("non-remote"); diff --git a/dom/base/test/chrome/test_document-element-inserted.xhtml b/dom/base/test/chrome/test_document-element-inserted.xhtml index 5fd35e364d82..18e75203a5d0 100644 --- a/dom/base/test/chrome/test_document-element-inserted.xhtml +++ b/dom/base/test/chrome/test_document-element-inserted.xhtml @@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1411707 // expect both events to fire with the docs in the correct state. async function testEvents() { info(`Waiting for events after loading ${OUTER_URL}`); - let win = window.browsingContext.topChromeWindow.openDialog(OUTER_URL, "_blank", "chrome,dialog=no,all"); + let win = docShell.rootTreeItem.domWindow.openDialog(OUTER_URL, "_blank", "chrome,dialog=no,all"); await waitForEvent(OUTER_URL); await waitForEvent(INNER_URL); win.close(); diff --git a/dom/base/test/test_bug1016960.html b/dom/base/test/test_bug1016960.html index d801a1dba522..1c7f9077d240 100644 --- a/dom/base/test/test_bug1016960.html +++ b/dom/base/test/test_bug1016960.html @@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1016960 /** Test for Bug 1016960 **/ - var chromeWindow = window.browsingContext.topChromeWindow.open("chrome://mochitests/content/chrome/dom/base/test/file_empty.html", "1016960", "chrome"); + var chromeWindow = docShell.rootTreeItem.domWindow.open("chrome://mochitests/content/chrome/dom/base/test/file_empty.html", "1016960", "chrome"); ok(chromeWindow.isChromeWindow, "A chrome window should return true for .isChromeWindow."); chromeWindow.close(); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 4ac859272a29..655857f5bba3 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -9528,9 +9528,7 @@ class CGSpecializedGetter(CGAbstractStaticMethod): if self.attr.getExtendedAttribute("CrossOriginReadable"): remoteType = type extendedAttributes = self.descriptor.getExtendedAttributes(self.attr, getter=True) - if (remoteType.isGeckoInterface() - and not remoteType.unroll().inner.isExternal() - and remoteType.unroll().inner.getExtendedAttribute("ChromeOnly") is None): + if remoteType.isGeckoInterface() and not remoteType.unroll().inner.isExternal(): # We'll use a JSObject. It might make more sense to use remoteType's # RemoteProxy, but it's not easy to construct a type for that from here. remoteType = BuiltinTypes[IDLBuiltinType.Types.object] diff --git a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html index 9a1f7503bb7a..74ab79a8d537 100644 --- a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html +++ b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html @@ -29,8 +29,8 @@ // Need to open as a toplevel chrome window so that // DRAWWINDOW_USE_WIDGET_LAYERS is honored. - sourceWindow = window.browsingContext.topChromeWindow.open("file_drawWindow_source.html", "", - `chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`); + sourceWindow = docShell.rootTreeItem.domWindow.open("file_drawWindow_source.html", "", + `chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`); SimpleTest.waitForFocus(runTests, sourceWindow); } diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl index acdd7e3e20ff..8ada4591ade4 100644 --- a/dom/chrome-webidl/BrowsingContext.webidl +++ b/dom/chrome-webidl/BrowsingContext.webidl @@ -115,8 +115,6 @@ interface CanonicalBrowsingContext : BrowsingContext { readonly attribute WindowGlobalParent? currentWindowGlobal; - readonly attribute WindowProxy? topChromeWindow; - // XXX(nika): This feels kinda hacky, but will do for now while we don't // synchronously create WindowGlobalParent. It can throw if somehow the // content process has died. diff --git a/dom/events/test/test_bug1412775.xhtml b/dom/events/test/test_bug1412775.xhtml index 3146a489f162..3e6ffb9783f0 100644 --- a/dom/events/test/test_bug1412775.xhtml +++ b/dom/events/test/test_bug1412775.xhtml @@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1412775 var win; function init() { SimpleTest.waitForExplicitFinish(); - win = window.browsingContext.topChromeWindow.open("window_bug1412775.xhtml", "_new", "chrome"); + win = docShell.rootTreeItem.domWindow.open("window_bug1412775.xhtml", "_new", "chrome"); win.onload = function() { var b = win.document.getElementById("browser"); var d = b.contentWindow.document; diff --git a/dom/events/test/test_bug617528.xhtml b/dom/events/test/test_bug617528.xhtml index 2d2e0e006014..178b01c23068 100644 --- a/dom/events/test/test_bug617528.xhtml +++ b/dom/events/test/test_bug617528.xhtml @@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=617528 var browser; function start() { - _window = window.browsingContext.topChromeWindow.open("window_bug617528.xhtml", "_new", "chrome"); + _window = docShell.rootTreeItem.domWindow.open("window_bug617528.xhtml", "_new", "chrome"); _window.addEventListener("load", onLoad, false); } diff --git a/dom/ipc/remote-test.js b/dom/ipc/remote-test.js index 395aef8e474b..ee95201572f8 100644 --- a/dom/ipc/remote-test.js +++ b/dom/ipc/remote-test.js @@ -14,9 +14,7 @@ cpm.addMessageListener("cpm-async", function(m) { cpm.sendAsyncMessage("ppm-async"); }); -var dshell = content.docShell.sameTypeRootTreeItem.QueryInterface( - Ci.nsIDocShell -); +var dshell = content.docShell.rootTreeItem.QueryInterface(Ci.nsIDocShell); addEventListener( "click", diff --git a/dom/ipc/tests/test_process_error.xhtml b/dom/ipc/tests/test_process_error.xhtml index d122e7fedd77..b3542fbf348e 100644 --- a/dom/ipc/tests/test_process_error.xhtml +++ b/dom/ipc/tests/test_process_error.xhtml @@ -9,7 +9,7 @@ SimpleTest.waitForExplicitFinish(); SimpleTest.expectChildProcessCrash(); - var w = window.browsingContext.topChromeWindow.openDialog('process_error.xhtml', '_blank', 'chrome,resizable=yes,width=400,height=600', window); + var w = docShell.rootTreeItem.domWindow.openDialog('process_error.xhtml', '_blank', 'chrome,resizable=yes,width=400,height=600', window); function done() { diff --git a/dom/ipc/tests/test_process_error_oom.xhtml b/dom/ipc/tests/test_process_error_oom.xhtml index 03de3b07eb03..f4aa7293107a 100644 --- a/dom/ipc/tests/test_process_error_oom.xhtml +++ b/dom/ipc/tests/test_process_error_oom.xhtml @@ -9,7 +9,7 @@ SimpleTest.waitForExplicitFinish(); SimpleTest.expectChildProcessCrash(); - var w = window.browsingContext.topChromeWindow.openDialog('process_error.xhtml?crashType=CRASH_OOM', '_blank', 'chrome,resizable=yes,width=400,height=600', window); + var w = window.docShell.rootTreeItem.domWindow.openDialog('process_error.xhtml?crashType=CRASH_OOM', '_blank', 'chrome,resizable=yes,width=400,height=600', window); function done() { diff --git a/dom/plugins/test/mochitest/test_privatemode_perwindowpb.xhtml b/dom/plugins/test/mochitest/test_privatemode_perwindowpb.xhtml index 322b58485644..f0d70ab42357 100644 --- a/dom/plugins/test/mochitest/test_privatemode_perwindowpb.xhtml +++ b/dom/plugins/test/mochitest/test_privatemode_perwindowpb.xhtml @@ -54,7 +54,7 @@ async function runTestsCallback() { is(state2, false, "Browser returned incorrect private mode state."); // open a window with private mode and get the references of the elements. - var mainWindow = window.browsingContext.topChromeWindow; + var mainWindow = window.docShell.rootTreeItem.domWindow; var contentPage = getRootDirectory(window.location.href) + "privatemode_perwindowpb.xhtml"; function testOnWindow(aIsPrivate, aCallback) { diff --git a/dom/plugins/test/mochitest/test_xulbrowser_plugin_visibility.xhtml b/dom/plugins/test/mochitest/test_xulbrowser_plugin_visibility.xhtml index a710f6ecb316..c540e3d35dc3 100644 --- a/dom/plugins/test/mochitest/test_xulbrowser_plugin_visibility.xhtml +++ b/dom/plugins/test/mochitest/test_xulbrowser_plugin_visibility.xhtml @@ -10,7 +10,7 @@ SimpleTest.waitForExplicitFinish(); setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); - var w = window.browsingContext.topChromeWindow.openDialog('xulbrowser_plugin_visibility.xhtml', '_blank', 'chrome,resizable=yes,width=400,height=600', window); + var w = docShell.rootTreeItem.domWindow.openDialog('xulbrowser_plugin_visibility.xhtml', '_blank', 'chrome,resizable=yes,width=400,height=600', window); function done() { diff --git a/dom/serviceworkers/test/test_privateBrowsing.html b/dom/serviceworkers/test/test_privateBrowsing.html index 6a10f375f94d..cdb0622b332f 100644 --- a/dom/serviceworkers/test/test_privateBrowsing.html +++ b/dom/serviceworkers/test/test_privateBrowsing.html @@ -31,7 +31,7 @@ function testOnWindow(aIsPrivate, aCallback) { } function setupWindow() { - mainWindow = window.browsingContext.topChromeWindow; + mainWindow = window.docShell.rootTreeItem.domWindow; runTest(); } diff --git a/dom/tests/mochitest/beacon/test_beaconCookies.html b/dom/tests/mochitest/beacon/test_beaconCookies.html index 2c5016aafa15..072667208094 100644 --- a/dom/tests/mochitest/beacon/test_beaconCookies.html +++ b/dom/tests/mochitest/beacon/test_beaconCookies.html @@ -36,7 +36,7 @@ function whenDelayedStartupFinished(aWindow, aCallback) { } function testOnWindow(options, callback) { - var mainWindow = window.browsingContext.topChromeWindow; + var mainWindow = window.docShell.rootTreeItem.domWindow; var win = mainWindow.OpenBrowserWindow(options); windowsToClose.push(win); diff --git a/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xhtml b/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xhtml index 2a5227a84177..6b37608de45e 100644 --- a/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xhtml +++ b/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xhtml @@ -38,7 +38,7 @@ SpecialPowers.pushPrefEnv({"set": [ ]}, setup); function setup() { - newwindow = window.browsingContext.topChromeWindow.openDialog( + newwindow = docShell.rootTreeItem.domWindow.openDialog( "MozDomFullscreen_chrome.xhtml", "_blank","chrome,dialog=no,resizable=yes,width=400,height=400", window); } diff --git a/dom/tests/mochitest/chrome/test_activation.xhtml b/dom/tests/mochitest/chrome/test_activation.xhtml index 2bc5a7d98d13..bc23914917a0 100644 --- a/dom/tests/mochitest/chrome/test_activation.xhtml +++ b/dom/tests/mochitest/chrome/test_activation.xhtml @@ -26,7 +26,7 @@ diff --git a/toolkit/content/aboutProfiles.js b/toolkit/content/aboutProfiles.js index 36b730f0688e..6ad39b16be37 100644 --- a/toolkit/content/aboutProfiles.js +++ b/toolkit/content/aboutProfiles.js @@ -208,7 +208,7 @@ function CreateProfile(profile) { function createProfileWizard() { // This should be rewritten in HTML eventually. - window.browsingContext.topChromeWindow.openDialog( + window.docShell.rootTreeItem.domWindow.openDialog( "chrome://mozapps/content/profile/createProfileWizard.xhtml", "", "centerscreen,chrome,modal,titlebar", diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index c80dc8b11700..b00a5f54a0f9 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -1521,7 +1521,7 @@ function setupEventListeners() { button = $("show-update-history-button"); if (button) { button.addEventListener("click", function(event) { - window.browsingContext.topChromeWindow.openDialog( + window.docShell.rootTreeItem.domWindow.openDialog( "chrome://mozapps/content/update/history.xhtml", "Update:History", "centerscreen,resizable=no,titlebar,modal" diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js index aeb8a31d7c9c..6133c0b27ff5 100644 --- a/toolkit/content/aboutTelemetry.js +++ b/toolkit/content/aboutTelemetry.js @@ -145,7 +145,7 @@ function sectionalizeObject(obj) { * Obtain the main DOMWindow for the current context. */ function getMainWindow() { - return window.browsingContext.topChromeWindow; + return window.docShell.rootTreeItem.domWindow; } /** diff --git a/toolkit/content/tests/chrome/test_browser_drop.xhtml b/toolkit/content/tests/chrome/test_browser_drop.xhtml index 3b0f0fdb2b7a..1324a70dfe0c 100644 --- a/toolkit/content/tests/chrome/test_browser_drop.xhtml +++ b/toolkit/content/tests/chrome/test_browser_drop.xhtml @@ -12,7 +12,7 @@ SimpleTest.waitForExplicitFinish(); function runTest() { add_task(async function() { - let win = window.browsingContext.topChromeWindow.openDialog("window_browser_drop.xhtml", "_blank", "chrome,width=200,height=200", window); + let win = docShell.rootTreeItem.domWindow.openDialog("window_browser_drop.xhtml", "_blank", "chrome,width=200,height=200", window); await SimpleTest.promiseFocus(win); for (let browserType of ["content", "remote-content"]) { await win.dropLinksOnBrowser(win.document.getElementById(browserType + "child"), browserType); diff --git a/toolkit/content/tests/chrome/test_bug624329.xhtml b/toolkit/content/tests/chrome/test_bug624329.xhtml index 59b57a1607f1..5706c2eb5944 100644 --- a/toolkit/content/tests/chrome/test_bug624329.xhtml +++ b/toolkit/content/tests/chrome/test_bug624329.xhtml @@ -28,7 +28,7 @@ var timeoutID; var menu; function openTestWindow() { - win = window.browsingContext.topChromeWindow.openDialog("bug624329_window.xhtml", "_blank", "width=300,resizable=yes,chrome", window); + win = docShell.rootTreeItem.domWindow.openDialog("bug624329_window.xhtml", "_blank", "width=300,resizable=yes,chrome", window); // Close our window if the test times out so that it doesn't interfere // with later tests. timeoutID = setTimeout(function () { diff --git a/toolkit/content/tests/chrome/test_dialogfocus.xhtml b/toolkit/content/tests/chrome/test_dialogfocus.xhtml index a89dca2ba53e..57592432d456 100644 --- a/toolkit/content/tests/chrome/test_dialogfocus.xhtml +++ b/toolkit/content/tests/chrome/test_dialogfocus.xhtml @@ -59,7 +59,7 @@ function runTest() var expectedFocus = expected[step - 1]; let filename = expectedFocus == "root" ? "dialog_dialogfocus2.xhtml" : "dialog_dialogfocus.xhtml"; - var win = window.browsingContext.topChromeWindow.openDialog(filename, "_new", "chrome,dialog", step); + var win = docShell.rootTreeItem.domWindow.openDialog(filename, "_new", "chrome,dialog", step); function checkDialogFocus(event) { diff --git a/toolkit/content/tests/chrome/test_edit_contextmenu.html b/toolkit/content/tests/chrome/test_edit_contextmenu.html index b9eb30a8eb06..41a2ba61eaf7 100644 --- a/toolkit/content/tests/chrome/test_edit_contextmenu.html +++ b/toolkit/content/tests/chrome/test_edit_contextmenu.html @@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1513343 SimpleTest.waitForExplicitFinish(); async function runTest() { - let win = window.browsingContext.topChromeWindow.open("file_edit_contextmenu.xhtml", "context-menu", "chrome,width=600,height=600"); + let win = window.docShell.rootTreeItem.domWindow.open("file_edit_contextmenu.xhtml", "context-menu", "chrome,width=600,height=600"); await new Promise(r => win.addEventListener("load", r, { once: true})); await SimpleTest.promiseFocus(win); diff --git a/toolkit/content/tests/chrome/test_maximized_persist.xhtml b/toolkit/content/tests/chrome/test_maximized_persist.xhtml index c8558eb25c94..4355267e0144 100644 --- a/toolkit/content/tests/chrome/test_maximized_persist.xhtml +++ b/toolkit/content/tests/chrome/test_maximized_persist.xhtml @@ -26,7 +26,7 @@ } function openWindow(features = "") { - return window.browsingContext.topChromeWindow.openDialog( + return docShell.rootTreeItem.domWindow.openDialog( "window_maximized_persist.xhtml", "_blank", "chrome,dialog=no,all," + features, window); } diff --git a/toolkit/content/tests/chrome/test_navigate_persist.html b/toolkit/content/tests/chrome/test_navigate_persist.html index 794422bfb793..78693320b019 100644 --- a/toolkit/content/tests/chrome/test_navigate_persist.html +++ b/toolkit/content/tests/chrome/test_navigate_persist.html @@ -44,7 +44,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1460639 // first loading about:blank and then navigating to window_navigate_persist.html. const PERSIST_SIZE = 200; // First, load the document and resize it so the size is persisted. - let win = window.browsingContext.topChromeWindow + let win = window.docShell.rootTreeItem.domWindow .openDialog("window_navigate_persist.html", "_blank", `chrome,all,dialog=no`); await SimpleTest.promiseFocus(win); await resize(win, PERSIST_SIZE); @@ -53,7 +53,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1460639 win.close(); // Now mimic early first paint. - win = window.browsingContext.topChromeWindow + win = window.docShell.rootTreeItem.domWindow .openDialog("about:blank", "_blank", `chrome,all,dialog=no`); await SimpleTest.promiseFocus(win, true); isnot(win.outerWidth, PERSIST_SIZE, "Initial window width is not the persisted size"); diff --git a/toolkit/content/tests/chrome/test_preferences.xhtml b/toolkit/content/tests/chrome/test_preferences.xhtml index 3d96a498f28c..ad191a445dd0 100644 --- a/toolkit/content/tests/chrome/test_preferences.xhtml +++ b/toolkit/content/tests/chrome/test_preferences.xhtml @@ -444,11 +444,11 @@ { // test with instantApply InitTestPrefs(true); - window.browsingContext.topChromeWindow.openDialog("window_preferences.xhtml", "", "modal", RunInstantPrefTest, false); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences.xhtml", "", "modal", RunInstantPrefTest, false); // - test deferred reset in child window InitTestPrefs(true); - window.browsingContext.topChromeWindow.openDialog("window_preferences2.xhtml", "", "modal", RunResetPrefTest, false); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences2.xhtml", "", "modal", RunResetPrefTest, false); expected = kPrefValueSet1; found = ReadPrefsFromSystem(); ok(found.int === expected.int, "instant reset deferred int" ); @@ -464,11 +464,11 @@ // test without instantApply // - general tests, similar to instant apply InitTestPrefs(false); - window.browsingContext.topChromeWindow.openDialog("window_preferences.xhtml", "", "modal", RunNonInstantPrefTestGeneral, false); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences.xhtml", "", "modal", RunNonInstantPrefTestGeneral, false); // - test Cancel InitTestPrefs(false); - window.browsingContext.topChromeWindow.openDialog("window_preferences.xhtml", "", "modal", RunNonInstantPrefTestClose, false); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences.xhtml", "", "modal", RunNonInstantPrefTestClose, false); var expected = kPrefValueSet1; var found = ReadPrefsFromSystem(); ok(found.int === expected.int, "non-instant cancel system int" ); @@ -480,7 +480,7 @@ // - test Accept InitTestPrefs(false); - window.browsingContext.topChromeWindow.openDialog("window_preferences.xhtml", "", "modal", RunNonInstantPrefTestClose, true); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences.xhtml", "", "modal", RunNonInstantPrefTestClose, true); expected = kPrefValueSet2; found = ReadPrefsFromSystem(); ok(found.int === expected.int, "non-instant accept system int" ); @@ -492,7 +492,7 @@ // - test deferred reset in child window InitTestPrefs(false); - window.browsingContext.topChromeWindow.openDialog("window_preferences2.xhtml", "", "modal", RunResetPrefTest, true); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences2.xhtml", "", "modal", RunResetPrefTest, true); expected = CreateEmptyPrefValueSet(); found = ReadPrefsFromSystem(); ok(found.int === expected.int, "non-instant reset deferred int" ); @@ -505,7 +505,7 @@ function RunTestCommandRedirect() { - window.browsingContext.topChromeWindow.openDialog("window_preferences_commandretarget.xhtml", "", "modal", RunCheckCommandRedirect, true); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_commandretarget.xhtml", "", "modal", RunCheckCommandRedirect, true); } function RunTestDisabled() @@ -514,7 +514,7 @@ const defaultBranch = kPref.getDefaultBranch(""); defaultBranch.setBoolPref("tests.locked_preference_bool", true); defaultBranch.lockPref("tests.locked_preference_bool"); - window.browsingContext.topChromeWindow.openDialog("window_preferences_disabled.xhtml", "", "modal", RunCheckDisabled, true); + window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_disabled.xhtml", "", "modal", RunCheckDisabled, true); } function RunTest() diff --git a/toolkit/content/tests/chrome/test_preferences_beforeaccept.xhtml b/toolkit/content/tests/chrome/test_preferences_beforeaccept.xhtml index cbb5d059f39b..beb4a1495444 100644 --- a/toolkit/content/tests/chrome/test_preferences_beforeaccept.xhtml +++ b/toolkit/content/tests/chrome/test_preferences_beforeaccept.xhtml @@ -18,7 +18,7 @@ }); // No instant-apply for this test - var prefWindow = window.browsingContext.topChromeWindow.openDialog("window_preferences_beforeaccept.xhtml", "", "", windowOnload); + var prefWindow = window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_beforeaccept.xhtml", "", "", windowOnload); function windowOnload() { var dialogShown = prefWindow.Preferences.get("tests.beforeaccept.dialogShown"); diff --git a/toolkit/content/tests/chrome/test_preferences_onsyncfrompreference.xhtml b/toolkit/content/tests/chrome/test_preferences_onsyncfrompreference.xhtml index 3f4d2037c569..cd53c148ce15 100644 --- a/toolkit/content/tests/chrome/test_preferences_onsyncfrompreference.xhtml +++ b/toolkit/content/tests/chrome/test_preferences_onsyncfrompreference.xhtml @@ -24,7 +24,7 @@ } let counter = 0; - let prefWindow = window.browsingContext.topChromeWindow.openDialog("window_preferences_onsyncfrompreference.xhtml", "", "", onSync); + let prefWindow = window.docShell.rootTreeItem.domWindow.openDialog("window_preferences_onsyncfrompreference.xhtml", "", "", onSync); SimpleTest.registerCleanupFunction(() => { for (let pref of PREFS) { diff --git a/toolkit/content/tests/chrome/test_screenPersistence.xhtml b/toolkit/content/tests/chrome/test_screenPersistence.xhtml index 5e9d6de3e351..1250f00ac5e9 100644 --- a/toolkit/content/tests/chrome/test_screenPersistence.xhtml +++ b/toolkit/content/tests/chrome/test_screenPersistence.xhtml @@ -16,7 +16,7 @@ var upper = 60 + screen.availTop; function runTest() { - win = window.browsingContext.topChromeWindow + win = window.docShell.rootTreeItem.domWindow .openDialog("window_screenPosSize.xhtml", "_blank", "chrome,dialog=no,all,screenX=" + left + ",screenY=" + upper + ",outerHeight=200,outerWidth=200"); @@ -31,7 +31,7 @@ } function runTest2() { win.close(); - win = window.browsingContext.topChromeWindow + win = window.docShell.rootTreeItem.domWindow .openDialog("window_screenPosSize.xhtml", "_blank", "chrome,dialog=no,all"); diff --git a/toolkit/content/tests/chrome/test_showcaret.xhtml b/toolkit/content/tests/chrome/test_showcaret.xhtml index 9a1d47353e28..2e538f0e2012 100644 --- a/toolkit/content/tests/chrome/test_showcaret.xhtml +++ b/toolkit/content/tests/chrome/test_showcaret.xhtml @@ -59,7 +59,7 @@ function runTest() isnot(sel2.focusNode, frames[1].document.body, "focusNode for showcaret"); ok(sel2.anchorOffset > 0, "focusOffset for showcaret"); - otherWindow = window.browsingContext.topChromeWindow.open("window_showcaret.xhtml", "_blank", "chrome,width=400,height=200"); + otherWindow = window.docShell.rootTreeItem.domWindow.open("window_showcaret.xhtml", "_blank", "chrome,width=400,height=200"); otherWindow.addEventListener("focus", otherWindowFocused, false); } diff --git a/toolkit/content/tests/chrome/test_window_intrinsic_size.xhtml b/toolkit/content/tests/chrome/test_window_intrinsic_size.xhtml index 451d2f0cce4e..4c7d8e972489 100644 --- a/toolkit/content/tests/chrome/test_window_intrinsic_size.xhtml +++ b/toolkit/content/tests/chrome/test_window_intrinsic_size.xhtml @@ -10,7 +10,7 @@ SimpleTest.waitForExplicitFinish(); function openWindow(features = "") { - return window.browsingContext.topChromeWindow + return window.docShell.rootTreeItem.domWindow .openDialog("window_intrinsic_size.xhtml", "", "chrome,dialog=no,all," + features); } diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm index 98079fc17a76..e3a1703164a2 100644 --- a/toolkit/modules/ResetProfile.jsm +++ b/toolkit/modules/ResetProfile.jsm @@ -54,7 +54,7 @@ var ResetProfile = { let params = { reset: false, }; - window.browsingContext.topChromeWindow.openDialog( + window.docShell.rootTreeItem.domWindow.openDialog( "chrome://global/content/resetProfile.xhtml", null, "modal,centerscreen,titlebar", diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm index 1470d607b630..a1ea8eb93405 100644 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm @@ -181,7 +181,7 @@ nsUnknownContentTypeDialog.prototype = { reallyShow() { try { let docShell = this.mContext.getInterface(Ci.nsIDocShell); - let rootWin = docShell.browsingContext.topChromeWindow; + let rootWin = docShell.rootTreeItem.domWindow; this.mDialog = Services.ww.openWindow( rootWin, "chrome://mozapps/content/downloads/unknownContentType.xhtml", diff --git a/toolkit/mozapps/handling/ContentDispatchChooser.jsm b/toolkit/mozapps/handling/ContentDispatchChooser.jsm index a9fb2f882601..931ccb019c48 100644 --- a/toolkit/mozapps/handling/ContentDispatchChooser.jsm +++ b/toolkit/mozapps/handling/ContentDispatchChooser.jsm @@ -19,7 +19,7 @@ nsContentDispatchChooser.prototype = { // nsIContentDispatchChooser ask: function ask(aHandler, aBrowsingContext, aURI, aReason) { - let window = aBrowsingContext?.topChromeWindow || null; + let window = aBrowsingContext?.top?.embedderElement?.ownerGlobal || null; var bundle = Services.strings.createBundle(STRINGBUNDLE_URL); diff --git a/widget/tests/test_bug1123480.xhtml b/widget/tests/test_bug1123480.xhtml index dca9bcf207c3..7651ee568d0a 100644 --- a/widget/tests/test_bug1123480.xhtml +++ b/widget/tests/test_bug1123480.xhtml @@ -96,7 +96,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1123480 // disabled and enabled const {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); for (let private of [false, true]) { - var win = window.browsingContext.topChromeWindow.open("about:blank", "_blank", "chrome, width=500, height=200" + (private ? ", private" : "")); + var win = docShell.rootTreeItem.domWindow.open("about:blank", "_blank", "chrome, width=500, height=200" + (private ? ", private" : "")); ok(win, private ? "should open private window" : "should open non-private window"); is(PrivateBrowsingUtils.isContentWindowPrivate(win), private, "used correct window context"); diff --git a/widget/tests/test_bug538242.xhtml b/widget/tests/test_bug538242.xhtml index 4608a74e355c..23e98d617a4a 100644 --- a/widget/tests/test_bug538242.xhtml +++ b/widget/tests/test_bug538242.xhtml @@ -34,7 +34,7 @@ SimpleTest.waitForFocus(function () { return; } - var win = window.browsingContext.topChromeWindow.open( + var win = docShell.rootTreeItem.domWindow.open( "window_bug538242.xhtml", "_blank", "chrome,width=400,height=300,left=100,top=100"); SimpleTest.waitForFocus(function () { diff --git a/widget/tests/test_bug593307.xhtml b/widget/tests/test_bug593307.xhtml index 770dd390cbfe..61b2f52f831e 100644 --- a/widget/tests/test_bug593307.xhtml +++ b/widget/tests/test_bug593307.xhtml @@ -28,7 +28,7 @@ function finish() { SimpleTest.finish(); } -var mainWindow = window.browsingContext.topChromeWindow; +var mainWindow = window.docShell.rootTreeItem.domWindow; var offscreenWindow = mainWindow.openDialog("window_bug593307_offscreen.xhtml", "", "dialog=no,chrome,width=200,height=200,screenX=-3000,screenY=-3000", diff --git a/widget/tests/test_bug596600.xhtml b/widget/tests/test_bug596600.xhtml index 1d97a9c188b8..4f565ccfaa2e 100644 --- a/widget/tests/test_bug596600.xhtml +++ b/widget/tests/test_bug596600.xhtml @@ -32,10 +32,10 @@ function moveMouseTo(x, y, andThen) { } function openWindows() { - gLeftWindow = window.browsingContext.topChromeWindow + gLeftWindow = window.docShell.rootTreeItem.domWindow .open('empty_window.xhtml', '_blank', 'chrome,screenX=50,screenY=50,width=200,height=200'); SimpleTest.waitForFocus(function () { - gRightWindow = window.browsingContext.topChromeWindow + gRightWindow = window.docShell.rootTreeItem.domWindow .open('empty_window.xhtml', '', 'chrome,screenX=300,screenY=50,width=200,height=200'); SimpleTest.waitForFocus(attachBrowserToLeftWindow, gRightWindow); }, gLeftWindow); diff --git a/widget/tests/test_chrome_context_menus_win.xhtml b/widget/tests/test_chrome_context_menus_win.xhtml index 88ed834c97fb..fd9e80a4678a 100644 --- a/widget/tests/test_chrome_context_menus_win.xhtml +++ b/widget/tests/test_chrome_context_menus_win.xhtml @@ -13,7 +13,7 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); SimpleTest.waitForExplicitFinish(); - var w = window.browsingContext.topChromeWindow.openDialog( + var w = docShell.rootTreeItem.domWindow.openDialog( 'chrome_context_menus_win.xhtml', '_blank', 'chrome,resizable=yes,width=600,height=600', window); function done() diff --git a/widget/tests/test_input_events_on_deactive_window.xhtml b/widget/tests/test_input_events_on_deactive_window.xhtml index 3f5899fb47c7..7fd4c84f40b0 100644 --- a/widget/tests/test_input_events_on_deactive_window.xhtml +++ b/widget/tests/test_input_events_on_deactive_window.xhtml @@ -40,7 +40,7 @@ function runTests() } otherWindow = - window.browsingContext.topChromeWindow.open( + docShell.rootTreeItem.domWindow.open( "./file_input_events_on_deactive_window.html", "_blank", "chrome,width=100,height=100"); ok(otherWindow, "failed to open other window"); diff --git a/widget/tests/test_picker_no_crash.html b/widget/tests/test_picker_no_crash.html index b23ca53defb1..a1e2e520517a 100644 --- a/widget/tests/test_picker_no_crash.html +++ b/widget/tests/test_picker_no_crash.html @@ -14,7 +14,7 @@ SimpleTest.requestFlakyTimeout("untriaged"); var childWindow; function testStepOne() { - childWindow = window.browsingContext.topChromeWindow.open("window_picker_no_crash_child.html", "childWindow", "width=300,height=150"); + childWindow = window.docShell.rootTreeItem.domWindow.open("window_picker_no_crash_child.html", "childWindow", "width=300,height=150"); SimpleTest.waitForFocus(testStepTwo, childWindow); } diff --git a/widget/tests/test_position_on_resize.xhtml b/widget/tests/test_position_on_resize.xhtml index a7c555101808..d64dec298ed6 100644 --- a/widget/tests/test_position_on_resize.xhtml +++ b/widget/tests/test_position_on_resize.xhtml @@ -15,7 +15,7 @@ let win, x, y; function startTest() { - win = window.browsingContext.topChromeWindow.openDialog( + win = docShell.rootTreeItem.domWindow.openDialog( "about:blank", null, "chrome,dialog=no,outerHeight=170,outerWidth=200"); diff --git a/widget/tests/test_secure_input.html b/widget/tests/test_secure_input.html index 846465b4c25f..b6502d50af68 100644 --- a/widget/tests/test_secure_input.html +++ b/widget/tests/test_secure_input.html @@ -75,7 +75,7 @@ ok(true, "Not crashed: input on changed from type=\"password\""); var otherWindow = - window.browsingContext.topChromeWindow.open("file_secure_input.html", + window.docShell.rootTreeItem.domWindow.open("file_secure_input.html", "_blank", "chrome,width=100,height=100"); ok(otherWindow, "failed to open other window"); if (!otherWindow) { diff --git a/widget/tests/test_sizemode_events.xhtml b/widget/tests/test_sizemode_events.xhtml index f396c207a7d5..001bf6a4fd4f 100644 --- a/widget/tests/test_sizemode_events.xhtml +++ b/widget/tests/test_sizemode_events.xhtml @@ -56,7 +56,7 @@ function startTest() { } function openWindow() { - gWindow = window.browsingContext.topChromeWindow + gWindow = window.docShell.rootTreeItem.domWindow .open('empty_window.xhtml', '_blank', 'chrome,screenX=50,screenY=50,width=200,height=200,resizable'); SimpleTest.waitForFocus(runTest, gWindow); } diff --git a/widget/tests/test_transferable_overflow.xhtml b/widget/tests/test_transferable_overflow.xhtml index ad1650f00ad8..708fd9bf748e 100644 --- a/widget/tests/test_transferable_overflow.xhtml +++ b/widget/tests/test_transferable_overflow.xhtml @@ -81,7 +81,7 @@ const {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); - var win = window.browsingContext.topChromeWindow.open("about:blank", "_blank", "chrome, width=500, height=200"); + var win = docShell.rootTreeItem.domWindow.open("about:blank", "_blank", "chrome, width=500, height=200"); ok(win, "should open window"); is(PrivateBrowsingUtils.isContentWindowPrivate(win), false, "used correct window context"); diff --git a/widget/tests/window_bug429954.xhtml b/widget/tests/window_bug429954.xhtml index ca26d52621fe..1974e687cffa 100644 --- a/widget/tests/window_bug429954.xhtml +++ b/widget/tests/window_bug429954.xhtml @@ -14,7 +14,7 @@ function ok(aCondition, aMessage) { - window.browsingContext.topChromeWindow.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage); + docShell.rootTreeItem.domWindow.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage); } function is(aLeft, aRight, aMessage)