Bug 1286854 - Replace ownerDocument.defaultView with ownerGlobal in browser/. r=dao

--HG--
extra : rebase_source : 72d50e73baf595840a2aade57ae782e4c40d4c27
This commit is contained in:
Pushpankar 2016-07-16 10:20:04 +02:00
parent ca0706d1c4
commit c6670d980f
67 changed files with 177 additions and 190 deletions

View File

@ -363,7 +363,7 @@ var FullScreen = {
if (event.target == gBrowser) { if (event.target == gBrowser) {
browser = event.originalTarget; browser = event.originalTarget;
} else { } else {
let topWin = event.target.ownerDocument.defaultView.top; let topWin = event.target.ownerGlobal.top;
browser = gBrowser.getBrowserForContentWindow(topWin); browser = gBrowser.getBrowserForContentWindow(topWin);
} }
TelemetryStopwatch.start("FULLSCREEN_CHANGE_MS"); TelemetryStopwatch.start("FULLSCREEN_CHANGE_MS");

View File

@ -1166,7 +1166,7 @@ var PlacesToolbarHelper = {
onWidgetUnderflow: function(aNode, aContainer) { onWidgetUnderflow: function(aNode, aContainer) {
// The view gets broken by being removed and reinserted by the overflowable // The view gets broken by being removed and reinserted by the overflowable
// toolbar, so we have to force an uninit and reinit. // toolbar, so we have to force an uninit and reinit.
let win = aNode.ownerDocument.defaultView; let win = aNode.ownerGlobal;
if (aNode.id == "personal-bookmarks" && win == window) { if (aNode.id == "personal-bookmarks" && win == window) {
this._resetView(); this._resetView();
} }
@ -1909,7 +1909,7 @@ var BookmarkingUI = {
gNavigatorBundle.getString("starButtonOverflowedStarred.label"); gNavigatorBundle.getString("starButtonOverflowedStarred.label");
}, },
onWidgetOverflow: function(aNode, aContainer) { onWidgetOverflow: function(aNode, aContainer) {
let win = aNode.ownerDocument.defaultView; let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window) if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return; return;
@ -1925,7 +1925,7 @@ var BookmarkingUI = {
}, },
onWidgetUnderflow: function(aNode, aContainer) { onWidgetUnderflow: function(aNode, aContainer) {
let win = aNode.ownerDocument.defaultView; let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window) if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return; return;

View File

@ -183,7 +183,7 @@ SocialUI = {
return; return;
// Check to see whether this link traversal was in a social panel // Check to see whether this link traversal was in a social panel
let win = linkNode.ownerDocument.defaultView; let win = linkNode.ownerGlobal;
let container = win.QueryInterface(Ci.nsIInterfaceRequestor) let container = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell) .QueryInterface(Ci.nsIDocShell)

View File

@ -4410,7 +4410,7 @@ var XULBrowserWindow = {
pageTooltip.hidePopup(); pageTooltip.hidePopup();
} }
else { else {
for (let tooltipWindow = tooltipNode.ownerDocument.defaultView; for (let tooltipWindow = tooltipNode.ownerGlobal;
tooltipWindow != tooltipWindow.parent; tooltipWindow != tooltipWindow.parent;
tooltipWindow = tooltipWindow.parent) { tooltipWindow = tooltipWindow.parent) {
if (tooltipWindow == aWebProgress.DOMWindow) { if (tooltipWindow == aWebProgress.DOMWindow) {
@ -6041,7 +6041,7 @@ var IndexedDBPromptHelper = {
var requestor = subject.QueryInterface(Ci.nsIInterfaceRequestor); var requestor = subject.QueryInterface(Ci.nsIInterfaceRequestor);
var browser = requestor.getInterface(Ci.nsIDOMNode); var browser = requestor.getInterface(Ci.nsIDOMNode);
if (browser.ownerDocument.defaultView != window) { if (browser.ownerGlobal != window) {
// Only listen for notifications for browsers in our chrome window. // Only listen for notifications for browsers in our chrome window.
return; return;
} }

View File

@ -204,7 +204,7 @@ var showContentContextMenu = function (event) {
// commands on the context menu. // commands on the context menu.
docShell.contentViewer.QueryInterface(Ci.nsIContentViewerEdit) docShell.contentViewer.QueryInterface(Ci.nsIContentViewerEdit)
.setCommandNode(event.target); .setCommandNode(event.target);
event.target.ownerDocument.defaultView.updateCommands("contentcontextmenu"); event.target.ownerGlobal.updateCommands("contentcontextmenu");
let customMenuItems = PageMenuChild.build(event.target); let customMenuItems = PageMenuChild.build(event.target);
let principal = doc.nodePrincipal; let principal = doc.nodePrincipal;
@ -219,7 +219,7 @@ var showContentContextMenu = function (event) {
else { else {
// Break out to the parent window and pass the add-on info along // Break out to the parent window and pass the add-on info along
let browser = docShell.chromeEventHandler; let browser = docShell.chromeEventHandler;
let mainWin = browser.ownerDocument.defaultView; let mainWin = browser.ownerGlobal;
mainWin.gContextMenuContentData = { mainWin.gContextMenuContentData = {
isRemote: false, isRemote: false,
event: event, event: event,
@ -915,7 +915,7 @@ var LightWeightThemeWebInstallListener = {
baseURI: event.target.baseURI, baseURI: event.target.baseURI,
themeData: event.target.getAttribute("data-browsertheme"), themeData: event.target.getAttribute("data-browsertheme"),
}); });
this._previewWindow = event.target.ownerDocument.defaultView; this._previewWindow = event.target.ownerGlobal;
this._previewWindow.addEventListener("pagehide", this, true); this._previewWindow.addEventListener("pagehide", this, true);
break; break;
} }
@ -1170,7 +1170,7 @@ var PageInfoListener = {
getMediaItems: function(document, strings, elem) getMediaItems: function(document, strings, elem)
{ {
// Check for images defined in CSS (e.g. background, borders) // Check for images defined in CSS (e.g. background, borders)
let computedStyle = elem.ownerDocument.defaultView.getComputedStyle(elem, ""); let computedStyle = elem.ownerGlobal.getComputedStyle(elem);
// A node can have multiple media items associated with it - for example, // A node can have multiple media items associated with it - for example,
// multiple background images. // multiple background images.
let mediaItems = []; let mediaItems = [];

View File

@ -587,7 +587,7 @@ nsContextMenu.prototype = {
inspectNode: function() { inspectNode: function() {
let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let gBrowser = this.browser.ownerDocument.defaultView.gBrowser; let gBrowser = this.browser.ownerGlobal.gBrowser;
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(target, "inspector").then(toolbox => { return gDevTools.showToolbox(target, "inspector").then(toolbox => {

View File

@ -25,7 +25,7 @@ add_task(function* () {
let div = content.document.getElementById("badCertAdvancedPanel"); let div = content.document.getElementById("badCertAdvancedPanel");
// Confirm that the expert section is collapsed // Confirm that the expert section is collapsed
Assert.ok(div, "Advanced content div should exist"); Assert.ok(div, "Advanced content div should exist");
Assert.equal(div.ownerDocument.defaultView.getComputedStyle(div, "").display, Assert.equal(div.ownerGlobal.getComputedStyle(div).display,
"none", "Advanced content should not be visible by default"); "none", "Advanced content should not be visible by default");
}); });
@ -41,7 +41,7 @@ add_task(function* () {
yield remote(() => { yield remote(() => {
let div = content.document.getElementById("badCertAdvancedPanel"); let div = content.document.getElementById("badCertAdvancedPanel");
Assert.ok(div, "Advanced content div should exist"); Assert.ok(div, "Advanced content div should exist");
Assert.equal(div.ownerDocument.defaultView.getComputedStyle(div, "").display, Assert.equal(div.ownerGlobal.getComputedStyle(div).display,
"block", "Advanced content should be visible by default"); "block", "Advanced content should be visible by default");
}); });

View File

@ -113,7 +113,7 @@ function* testTrackingProtectionForTab(tab) {
info("Load a test page containing tracking elements"); info("Load a test page containing tracking elements");
yield promiseTabLoadEvent(tab, TRACKING_PAGE); yield promiseTabLoadEvent(tab, TRACKING_PAGE);
testTrackingPage(tab.ownerDocument.defaultView); testTrackingPage(tab.ownerGlobal);
info("Disable TP for the page (which reloads the page)"); info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab); let tabReloadPromise = promiseTabLoadEvent(tab);
@ -125,7 +125,7 @@ function* testTrackingProtectionForTab(tab) {
tabReloadPromise = promiseTabLoadEvent(tab); tabReloadPromise = promiseTabLoadEvent(tab);
clickButton("#tracking-action-block"); clickButton("#tracking-action-block");
yield tabReloadPromise; yield tabReloadPromise;
testTrackingPage(tab.ownerDocument.defaultView); testTrackingPage(tab.ownerGlobal);
} }
add_task(function* testNormalBrowsing() { add_task(function* testNormalBrowsing() {

View File

@ -25,7 +25,7 @@ registerCleanupFunction(function() {
}); });
function hidden(el) { function hidden(el) {
let win = el.ownerDocument.defaultView; let win = el.ownerGlobal;
let display = win.getComputedStyle(el).getPropertyValue("display", null); let display = win.getComputedStyle(el).getPropertyValue("display", null);
let opacity = win.getComputedStyle(el).getPropertyValue("opacity", null); let opacity = win.getComputedStyle(el).getPropertyValue("opacity", null);

View File

@ -85,7 +85,7 @@ add_task(function* testExceptionAddition() {
info("Load a test page containing tracking elements"); info("Load a test page containing tracking elements");
yield promiseTabLoadEvent(tab, TRACKING_PAGE); yield promiseTabLoadEvent(tab, TRACKING_PAGE);
testTrackingPage(tab.ownerDocument.defaultView); testTrackingPage(tab.ownerGlobal);
info("Disable TP for the page (which reloads the page)"); info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab); let tabReloadPromise = promiseTabLoadEvent(tab);
@ -117,7 +117,7 @@ add_task(function* testExceptionPersistence() {
info("Load a test page containing tracking elements"); info("Load a test page containing tracking elements");
yield promiseTabLoadEvent(tab, TRACKING_PAGE); yield promiseTabLoadEvent(tab, TRACKING_PAGE);
testTrackingPage(tab.ownerDocument.defaultView); testTrackingPage(tab.ownerGlobal);
info("Disable TP for the page (which reloads the page)"); info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab); let tabReloadPromise = promiseTabLoadEvent(tab);

View File

@ -13,7 +13,7 @@ function openContextMenuFor(element, shiftkey, waitForSpellCheck) {
function actuallyOpenContextMenuFor() { function actuallyOpenContextMenuFor() {
lastElement = element; lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey }; var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView); synthesizeMouse(element, 2, 2, eventDetails, element.ownerGlobal);
} }
if (waitForSpellCheck) { if (waitForSpellCheck) {

View File

@ -698,7 +698,7 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
let identityBox = gIdentityHandler._identityBox; let identityBox = gIdentityHandler._identityBox;
let classList = identityBox.classList; let classList = identityBox.classList;
let connectionIcon = doc.getElementById("connection-icon"); let connectionIcon = doc.getElementById("connection-icon");
let connectionIconImage = tabbrowser.ownerGlobal.getComputedStyle(connectionIcon, ""). let connectionIconImage = tabbrowser.ownerGlobal.getComputedStyle(connectionIcon).
getPropertyValue("list-style-image"); getPropertyValue("list-style-image");
let stateSecure = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_SECURE; let stateSecure = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_SECURE;
@ -775,9 +775,9 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
// Make sure the correct icon is visible in the Control Center. // Make sure the correct icon is visible in the Control Center.
// This logic is controlled with CSS, so this helps prevent regressions there. // This logic is controlled with CSS, so this helps prevent regressions there.
let securityView = doc.getElementById("identity-popup-securityView"); let securityView = doc.getElementById("identity-popup-securityView");
let securityViewBG = tabbrowser.ownerGlobal.getComputedStyle(securityView, ""). let securityViewBG = tabbrowser.ownerGlobal.getComputedStyle(securityView).
getPropertyValue("background-image"); getPropertyValue("background-image");
let securityContentBG = tabbrowser.ownerGlobal.getComputedStyle(securityView, ""). let securityContentBG = tabbrowser.ownerGlobal.getComputedStyle(securityView).
getPropertyValue("background-image"); getPropertyValue("background-image");
if (stateInsecure) { if (stateInsecure) {
@ -831,7 +831,7 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
} }
function is_hidden(element) { function is_hidden(element) {
var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") if (style.display == "none")
return true; return true;
if (style.visibility != "visible") if (style.visibility != "visible")
@ -847,7 +847,7 @@ function is_hidden(element) {
} }
function is_visible(element) { function is_visible(element) {
var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") if (style.display == "none")
return false; return false;
if (style.visibility != "visible") if (style.visibility != "visible")
@ -897,7 +897,7 @@ function promisePopupHidden(popup) {
} }
function promiseNotificationShown(notification) { function promiseNotificationShown(notification) {
let win = notification.browser.ownerDocument.defaultView; let win = notification.browser.ownerGlobal;
if (win.PopupNotifications.panel.state == "open") { if (win.PopupNotifications.panel.state == "open") {
return Promise.resolve(); return Promise.resolve();
} }

View File

@ -250,7 +250,7 @@ function makeActionURI(action, params) {
} }
function is_hidden(element) { function is_hidden(element) {
var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") if (style.display == "none")
return true; return true;
if (style.visibility != "visible") if (style.visibility != "visible")
@ -266,7 +266,7 @@ function is_hidden(element) {
} }
function is_visible(element) { function is_visible(element) {
var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") if (style.display == "none")
return false; return false;
if (style.visibility != "visible") if (style.visibility != "visible")

View File

@ -165,7 +165,7 @@ function promisePopupEvent(popup, eventSuffix) {
} }
function promiseNotificationShown(notification) { function promiseNotificationShown(notification) {
let win = notification.browser.ownerDocument.defaultView; let win = notification.browser.ownerGlobal;
if (win.PopupNotifications.panel.state == "open") { if (win.PopupNotifications.panel.state == "open") {
return Promise.resolve(); return Promise.resolve();
} }

View File

@ -126,7 +126,7 @@ function onPopupMenuCommand(event) {
function onFirefoxButtonClick(event) { function onFirefoxButtonClick(event) {
event.target.blur(); event.target.blur();
let activeStreams = webrtcUI.getActiveStreams(true, true, true); let activeStreams = webrtcUI.getActiveStreams(true, true, true);
activeStreams[0].browser.ownerDocument.defaultView.focus(); activeStreams[0].browser.ownerGlobal.focus();
} }
var PositionHandler = { var PositionHandler = {

View File

@ -12,7 +12,7 @@ function* openTabInUserContext(uri, userContextId) {
// select tab and make sure its browser is focused // select tab and make sure its browser is focused
gBrowser.selectedTab = tab; gBrowser.selectedTab = tab;
tab.ownerDocument.defaultView.focus(); tab.ownerGlobal.focus();
let browser = gBrowser.getBrowserForTab(tab); let browser = gBrowser.getBrowserForTab(tab);
yield BrowserTestUtils.browserLoaded(browser); yield BrowserTestUtils.browserLoaded(browser);

View File

@ -37,7 +37,7 @@ function* openTabInUserContext(uri, userContextId) {
// select tab and make sure its browser is focused // select tab and make sure its browser is focused
gBrowser.selectedTab = tab; gBrowser.selectedTab = tab;
tab.ownerDocument.defaultView.focus(); tab.ownerGlobal.focus();
let browser = gBrowser.getBrowserForTab(tab); let browser = gBrowser.getBrowserForTab(tab);
yield BrowserTestUtils.browserLoaded(browser); yield BrowserTestUtils.browserLoaded(browser);

View File

@ -61,7 +61,7 @@ function* openTabInUserContext(uri, userContextId) {
// Select tab and make sure its browser is focused. // Select tab and make sure its browser is focused.
gBrowser.selectedTab = tab; gBrowser.selectedTab = tab;
tab.ownerDocument.defaultView.focus(); tab.ownerGlobal.focus();
let browser = gBrowser.getBrowserForTab(tab); let browser = gBrowser.getBrowserForTab(tab);
yield BrowserTestUtils.browserLoaded(browser); yield BrowserTestUtils.browserLoaded(browser);

View File

@ -16,7 +16,7 @@ function openTabInUserContext(uri, userContextId) {
// select tab and make sure its browser is focused // select tab and make sure its browser is focused
gBrowser.selectedTab = tab; gBrowser.selectedTab = tab;
tab.ownerDocument.defaultView.focus(); tab.ownerGlobal.focus();
return tab; return tab;
} }

View File

@ -20,7 +20,7 @@ function openTabInUserContext(uri, userContextId) {
// select tab and make sure its browser is focused // select tab and make sure its browser is focused
gBrowser.selectedTab = tab; gBrowser.selectedTab = tab;
tab.ownerDocument.defaultView.focus(); tab.ownerGlobal.focus();
return tab; return tab;
} }

View File

@ -819,7 +819,7 @@ var CustomizableUIInternal = {
addPanelCloseListeners: function(aPanel) { addPanelCloseListeners: function(aPanel) {
gELS.addSystemEventListener(aPanel, "click", this, false); gELS.addSystemEventListener(aPanel, "click", this, false);
gELS.addSystemEventListener(aPanel, "keypress", this, false); gELS.addSystemEventListener(aPanel, "keypress", this, false);
let win = aPanel.ownerDocument.defaultView; let win = aPanel.ownerGlobal;
if (!gPanelsForWindow.has(win)) { if (!gPanelsForWindow.has(win)) {
gPanelsForWindow.set(win, new Set()); gPanelsForWindow.set(win, new Set());
} }
@ -829,7 +829,7 @@ var CustomizableUIInternal = {
removePanelCloseListeners: function(aPanel) { removePanelCloseListeners: function(aPanel) {
gELS.removeSystemEventListener(aPanel, "click", this, false); gELS.removeSystemEventListener(aPanel, "click", this, false);
gELS.removeSystemEventListener(aPanel, "keypress", this, false); gELS.removeSystemEventListener(aPanel, "keypress", this, false);
let win = aPanel.ownerDocument.defaultView; let win = aPanel.ownerGlobal;
let panels = gPanelsForWindow.get(win); let panels = gPanelsForWindow.get(win);
if (panels) { if (panels) {
panels.delete(this._getPanelForNode(aPanel)); panels.delete(this._getPanelForNode(aPanel));
@ -960,7 +960,7 @@ var CustomizableUIInternal = {
: true; : true;
for (let areaNode of areaNodes) { for (let areaNode of areaNodes) {
let window = areaNode.ownerDocument.defaultView; let window = areaNode.ownerGlobal;
if (!showInPrivateBrowsing && if (!showInPrivateBrowsing &&
PrivateBrowsingUtils.isWindowPrivate(window)) { PrivateBrowsingUtils.isWindowPrivate(window)) {
continue; continue;
@ -1020,7 +1020,7 @@ var CustomizableUIInternal = {
registerBuildArea: function(aArea, aNode) { registerBuildArea: function(aArea, aNode) {
// We ensure that the window is registered to have its customization data // We ensure that the window is registered to have its customization data
// cleaned up when unloading. // cleaned up when unloading.
let window = aNode.ownerDocument.defaultView; let window = aNode.ownerGlobal;
if (window.closed) { if (window.closed) {
return; return;
} }
@ -1138,7 +1138,7 @@ var CustomizableUIInternal = {
}, },
insertNodeInWindow: function(aWidgetId, aAreaNode, isNew) { insertNodeInWindow: function(aWidgetId, aAreaNode, isNew) {
let window = aAreaNode.ownerDocument.defaultView; let window = aAreaNode.ownerGlobal;
let showInPrivateBrowsing = gPalette.has(aWidgetId) let showInPrivateBrowsing = gPalette.has(aWidgetId)
? gPalette.get(aWidgetId).showInPrivateBrowsing ? gPalette.get(aWidgetId).showInPrivateBrowsing
: true; : true;
@ -1498,7 +1498,7 @@ var CustomizableUIInternal = {
aWidget.id); aWidget.id);
} }
} else if (aWidget.type == "view") { } else if (aWidget.type == "view") {
let ownerWindow = aNode.ownerDocument.defaultView; let ownerWindow = aNode.ownerGlobal;
let area = this.getPlacementOfWidget(aNode.id).area; let area = this.getPlacementOfWidget(aNode.id).area;
let anchor = aNode; let anchor = aNode;
if (area != CustomizableUI.AREA_PANEL) { if (area != CustomizableUI.AREA_PANEL) {
@ -1718,7 +1718,7 @@ var CustomizableUIInternal = {
}, },
getUnusedWidgets: function(aWindowPalette) { getUnusedWidgets: function(aWindowPalette) {
let window = aWindowPalette.ownerDocument.defaultView; let window = aWindowPalette.ownerGlobal;
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window); let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
// We use a Set because there can be overlap between the widgets in // We use a Set because there can be overlap between the widgets in
// gPalette and the items in the palette, especially after the first // gPalette and the items in the palette, especially after the first
@ -2498,7 +2498,7 @@ var CustomizableUIInternal = {
} }
for (let node of buildAreaNodes) { for (let node of buildAreaNodes) {
if (node.ownerDocument.defaultView === aWindow) { if (node.ownerGlobal == aWindow) {
return node.customizationTarget ? node.customizationTarget : node; return node.customizationTarget ? node.customizationTarget : node;
} }
} }
@ -2584,7 +2584,7 @@ var CustomizableUIInternal = {
let area = gAreas.get(areaId); let area = gAreas.get(areaId);
if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) { if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) {
let defaultCollapsed = area.get("defaultCollapsed"); let defaultCollapsed = area.get("defaultCollapsed");
let win = areaNode.ownerDocument.defaultView; let win = areaNode.ownerGlobal;
if (defaultCollapsed !== null) { if (defaultCollapsed !== null) {
win.setToolbarVisibility(areaNode, !defaultCollapsed, isFirstChangedToolbar); win.setToolbarVisibility(areaNode, !defaultCollapsed, isFirstChangedToolbar);
} }
@ -2710,7 +2710,7 @@ var CustomizableUIInternal = {
if (!areaNodes) { if (!areaNodes) {
return false; return false;
} }
let container = [...areaNodes].filter((n) => n.ownerDocument.defaultView == aWindow); let container = [...areaNodes].filter((n) => n.ownerGlobal == aWindow);
if (!container.length) { if (!container.length) {
return false; return false;
} }
@ -3813,7 +3813,7 @@ function WidgetGroupWrapper(aWidget) {
if (!buildAreas) { if (!buildAreas) {
return []; return [];
} }
return Array.from(buildAreas, (node) => this.forWindow(node.ownerDocument.defaultView)); return Array.from(buildAreas, (node) => this.forWindow(node.ownerGlobal));
}); });
this.__defineGetter__("areaType", function() { this.__defineGetter__("areaType", function() {
@ -3957,7 +3957,7 @@ function XULWidgetSingleWrapper(aWidgetId, aNode, aDocument) {
return aNode; return aNode;
} }
// ... or the toolbox // ... or the toolbox
let toolbox = aNode.ownerDocument.defaultView.gNavToolbox; let toolbox = aNode.ownerGlobal.gNavToolbox;
if (toolbox && toolbox.palette && aNode.parentNode == toolbox.palette) { if (toolbox && toolbox.palette && aNode.parentNode == toolbox.palette) {
return aNode; return aNode;
} }
@ -4018,7 +4018,7 @@ function OverflowableToolbar(aToolbarNode) {
this._list.toolbox = this._toolbar.toolbox; this._list.toolbox = this._toolbar.toolbox;
this._list.customizationTarget = this._list; this._list.customizationTarget = this._list;
let window = this._toolbar.ownerDocument.defaultView; let window = this._toolbar.ownerGlobal;
if (window.gBrowserInit.delayedStartupFinished) { if (window.gBrowserInit.delayedStartupFinished) {
this.init(); this.init();
} else { } else {
@ -4032,7 +4032,7 @@ OverflowableToolbar.prototype = {
observe: function(aSubject, aTopic, aData) { observe: function(aSubject, aTopic, aData) {
if (aTopic == "browser-delayed-startup-finished" && if (aTopic == "browser-delayed-startup-finished" &&
aSubject == this._toolbar.ownerDocument.defaultView) { aSubject == this._toolbar.ownerGlobal) {
Services.obs.removeObserver(this, "browser-delayed-startup-finished"); Services.obs.removeObserver(this, "browser-delayed-startup-finished");
this.init(); this.init();
} }
@ -4079,7 +4079,7 @@ OverflowableToolbar.prototype = {
this._disable(); this._disable();
let window = this._toolbar.ownerDocument.defaultView; let window = this._toolbar.ownerGlobal;
window.removeEventListener("resize", this); window.removeEventListener("resize", this);
window.gNavToolbox.removeEventListener("customizationstarting", this); window.gNavToolbox.removeEventListener("customizationstarting", this);
window.gNavToolbox.removeEventListener("aftercustomization", this); window.gNavToolbox.removeEventListener("aftercustomization", this);
@ -4190,7 +4190,7 @@ OverflowableToolbar.prototype = {
child = prevChild; child = prevChild;
} }
let win = this._target.ownerDocument.defaultView; let win = this._target.ownerGlobal;
win.UpdateUrlbarSearchSplitterState(); win.UpdateUrlbarSearchSplitterState();
}, },
@ -4239,7 +4239,7 @@ OverflowableToolbar.prototype = {
CustomizableUIInternal.notifyListeners("onWidgetUnderflow", child, this._target); CustomizableUIInternal.notifyListeners("onWidgetUnderflow", child, this._target);
} }
let win = this._target.ownerDocument.defaultView; let win = this._target.ownerGlobal;
win.UpdateUrlbarSearchSplitterState(); win.UpdateUrlbarSearchSplitterState();
if (!this._collapsed.size) { if (!this._collapsed.size) {
@ -4398,7 +4398,7 @@ OverflowableToolbar.prototype = {
_hideTimeoutId: null, _hideTimeoutId: null,
_showWithTimeout: function() { _showWithTimeout: function() {
this.show().then(function () { this.show().then(function () {
let window = this._toolbar.ownerDocument.defaultView; let window = this._toolbar.ownerGlobal;
if (this._hideTimeoutId) { if (this._hideTimeoutId) {
window.clearTimeout(this._hideTimeoutId); window.clearTimeout(this._hideTimeoutId);
} }

View File

@ -504,11 +504,9 @@ const CustomizableWidgets = [
shortcutId: "key_privatebrowsing", shortcutId: "key_privatebrowsing",
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(e) { onCommand: function(e) {
if (e.target && e.target.ownerDocument && e.target.ownerDocument.defaultView) { let win = e.target && e.target.ownerGlobal;
let win = e.target.ownerDocument.defaultView; if (win && typeof win.OpenBrowserWindow == "function") {
if (typeof win.OpenBrowserWindow == "function") { win.OpenBrowserWindow({private: true});
win.OpenBrowserWindow({private: true});
}
} }
} }
}, { }, {
@ -518,8 +516,7 @@ const CustomizableWidgets = [
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) { onCommand: function(aEvent) {
let win = aEvent.target && let win = aEvent.target &&
aEvent.target.ownerDocument && aEvent.target.ownerGlobal;
aEvent.target.ownerDocument.defaultView;
if (win && typeof win.saveBrowser == "function") { if (win && typeof win.saveBrowser == "function") {
win.saveBrowser(win.gBrowser.selectedBrowser); win.saveBrowser(win.gBrowser.selectedBrowser);
} }
@ -531,8 +528,7 @@ const CustomizableWidgets = [
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) { onCommand: function(aEvent) {
let win = aEvent.target && let win = aEvent.target &&
aEvent.target.ownerDocument && aEvent.target.ownerGlobal;
aEvent.target.ownerDocument.defaultView;
if (win && win.gFindBar) { if (win && win.gFindBar) {
win.gFindBar.onFindCommand(); win.gFindBar.onFindCommand();
} }
@ -544,8 +540,7 @@ const CustomizableWidgets = [
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) { onCommand: function(aEvent) {
let win = aEvent.target let win = aEvent.target
&& aEvent.target.ownerDocument && aEvent.target.ownerGlobal;
&& aEvent.target.ownerDocument.defaultView;
if (win && typeof win.BrowserOpenFileWindow == "function") { if (win && typeof win.BrowserOpenFileWindow == "function") {
win.BrowserOpenFileWindow(); win.BrowserOpenFileWindow();
} }
@ -623,8 +618,7 @@ const CustomizableWidgets = [
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) { onCommand: function(aEvent) {
let win = aEvent.target && let win = aEvent.target &&
aEvent.target.ownerDocument && aEvent.target.ownerGlobal;
aEvent.target.ownerDocument.defaultView;
if (win && typeof win.BrowserOpenAddonsMgr == "function") { if (win && typeof win.BrowserOpenAddonsMgr == "function") {
win.BrowserOpenAddonsMgr(); win.BrowserOpenAddonsMgr();
} }
@ -900,7 +894,7 @@ const CustomizableWidgets = [
tooltiptext: "feed-button.tooltiptext2", tooltiptext: "feed-button.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onClick: function(aEvent) { onClick: function(aEvent) {
let win = aEvent.target.ownerDocument.defaultView; let win = aEvent.target.ownerGlobal;
let feeds = win.gBrowser.selectedBrowser.feeds; let feeds = win.gBrowser.selectedBrowser.feeds;
// Here, we only care about the case where we have exactly 1 feed and the // Here, we only care about the case where we have exactly 1 feed and the
@ -926,7 +920,7 @@ const CustomizableWidgets = [
} }
}, },
onCreated: function(node) { onCreated: function(node) {
let win = node.ownerDocument.defaultView; let win = node.ownerGlobal;
let selectedBrowser = win.gBrowser.selectedBrowser; let selectedBrowser = win.gBrowser.selectedBrowser;
let feeds = selectedBrowser && selectedBrowser.feeds; let feeds = selectedBrowser && selectedBrowser.feeds;
if (!feeds || !feeds.length) { if (!feeds || !feeds.length) {
@ -1027,7 +1021,7 @@ const CustomizableWidgets = [
return; return;
} }
let window = node.ownerDocument.defaultView; let window = node.ownerGlobal;
let section = node.section; let section = node.section;
let value = node.value; let value = node.value;
@ -1161,8 +1155,7 @@ let preferencesButton = {
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) { onCommand: function(aEvent) {
let win = aEvent.target && let win = aEvent.target &&
aEvent.target.ownerDocument && aEvent.target.ownerGlobal;
aEvent.target.ownerDocument.defaultView;
if (win && typeof win.openPreferences == "function") { if (win && typeof win.openPreferences == "function") {
win.openPreferences(); win.openPreferences();
} }

View File

@ -1243,7 +1243,7 @@ CustomizeMode.prototype = {
}, },
onWidgetBeforeDOMChange: function(aNodeToChange, aSecondaryNode, aContainer) { onWidgetBeforeDOMChange: function(aNodeToChange, aSecondaryNode, aContainer) {
if (aContainer.ownerDocument.defaultView != this.window || this.resetting) { if (aContainer.ownerGlobal != this.window || this.resetting) {
return; return;
} }
if (aContainer.id == CustomizableUI.AREA_PANEL) { if (aContainer.id == CustomizableUI.AREA_PANEL) {
@ -1260,7 +1260,7 @@ CustomizeMode.prototype = {
}, },
onWidgetAfterDOMChange: function(aNodeToChange, aSecondaryNode, aContainer) { onWidgetAfterDOMChange: function(aNodeToChange, aSecondaryNode, aContainer) {
if (aContainer.ownerDocument.defaultView != this.window || this.resetting) { if (aContainer.ownerGlobal != this.window || this.resetting) {
return; return;
} }
// If the node is still attached to the container, wrap it again: // If the node is still attached to the container, wrap it again:
@ -1697,7 +1697,7 @@ CustomizeMode.prototype = {
dragValue = "before"; dragValue = "before";
} else { } else {
// Check if the aDraggedItem is hovered past the first half of dragOverItem // Check if the aDraggedItem is hovered past the first half of dragOverItem
let window = dragOverItem.ownerDocument.defaultView; let window = dragOverItem.ownerGlobal;
let direction = window.getComputedStyle(dragOverItem, null).direction; let direction = window.getComputedStyle(dragOverItem, null).direction;
let itemRect = dragOverItem.getBoundingClientRect(); let itemRect = dragOverItem.getBoundingClientRect();
let dropTargetCenter = itemRect.left + (itemRect.width / 2); let dropTargetCenter = itemRect.left + (itemRect.width / 2);
@ -1986,7 +1986,7 @@ CustomizeMode.prototype = {
// mozSourceNode is null in the dragStart event handler or if // mozSourceNode is null in the dragStart event handler or if
// the drag event originated in an external application. // the drag event originated in an external application.
return !mozSourceNode || return !mozSourceNode ||
mozSourceNode.ownerDocument.defaultView != this.window; mozSourceNode.ownerGlobal != this.window;
}, },
_setDragActive: function(aItem, aValue, aDraggedItemId, aInToolbar) { _setDragActive: function(aItem, aValue, aDraggedItemId, aInToolbar) {
@ -1997,7 +1997,7 @@ CustomizeMode.prototype = {
if (aItem.getAttribute("dragover") != aValue) { if (aItem.getAttribute("dragover") != aValue) {
aItem.setAttribute("dragover", aValue); aItem.setAttribute("dragover", aValue);
let window = aItem.ownerDocument.defaultView; let window = aItem.ownerGlobal;
let draggedItem = window.document.getElementById(aDraggedItemId); let draggedItem = window.document.getElementById(aDraggedItemId);
if (!aInToolbar) { if (!aInToolbar) {
this._setGridDragActive(aItem, draggedItem, aValue); this._setGridDragActive(aItem, draggedItem, aValue);
@ -2038,7 +2038,7 @@ CustomizeMode.prototype = {
} }
}, },
_cancelDragActive: function(aItem, aNextItem, aNoTransition) { _cancelDragActive: function(aItem, aNextItem, aNoTransition) {
this._updateToolbarCustomizationOutline(aItem.ownerDocument.defaultView); this._updateToolbarCustomizationOutline(aItem.ownerGlobal);
let currentArea = this._getCustomizableParent(aItem); let currentArea = this._getCustomizableParent(aItem);
if (!currentArea) { if (!currentArea) {
return; return;

View File

@ -15,7 +15,7 @@ this.EXPORTED_SYMBOLS = ["DragPositionManager"];
function AreaPositionManager(aContainer) { function AreaPositionManager(aContainer) {
// Caching the direction and bounds of the container for quick access later: // Caching the direction and bounds of the container for quick access later:
let window = aContainer.ownerDocument.defaultView; let window = aContainer.ownerGlobal;
this._dir = window.getComputedStyle(aContainer).direction; this._dir = window.getComputedStyle(aContainer).direction;
let containerRect = aContainer.getBoundingClientRect(); let containerRect = aContainer.getBoundingClientRect();
this._containerInfo = { this._containerInfo = {
@ -34,7 +34,7 @@ AreaPositionManager.prototype = {
_wideCache: null, _wideCache: null,
update: function(aContainer) { update: function(aContainer) {
let window = aContainer.ownerDocument.defaultView; let window = aContainer.ownerGlobal;
this._nodePositionStore = new WeakMap(); this._nodePositionStore = new WeakMap();
this._wideCache = new Set(); this._wideCache = new Set();
let last = null; let last = null;

View File

@ -301,7 +301,7 @@ function isPanelUIOpen() {
function subviewShown(aSubview) { function subviewShown(aSubview) {
let deferred = Promise.defer(); let deferred = Promise.defer();
let win = aSubview.ownerDocument.defaultView; let win = aSubview.ownerGlobal;
let timeoutId = win.setTimeout(() => { let timeoutId = win.setTimeout(() => {
deferred.reject("Subview (" + aSubview.id + ") did not show within 20 seconds."); deferred.reject("Subview (" + aSubview.id + ") did not show within 20 seconds.");
}, 20000); }, 20000);
@ -316,7 +316,7 @@ function subviewShown(aSubview) {
function subviewHidden(aSubview) { function subviewHidden(aSubview) {
let deferred = Promise.defer(); let deferred = Promise.defer();
let win = aSubview.ownerDocument.defaultView; let win = aSubview.ownerGlobal;
let timeoutId = win.setTimeout(() => { let timeoutId = win.setTimeout(() => {
deferred.reject("Subview (" + aSubview.id + ") did not hide within 20 seconds."); deferred.reject("Subview (" + aSubview.id + ") did not hide within 20 seconds.");
}, 20000); }, 20000);
@ -476,7 +476,7 @@ function popupHidden(aPopup) {
*/ */
function promisePopupEvent(aPopup, aEventSuffix) { function promisePopupEvent(aPopup, aEventSuffix) {
let deferred = Promise.defer(); let deferred = Promise.defer();
let win = aPopup.ownerDocument.defaultView; let win = aPopup.ownerGlobal;
let eventType = "popup" + aEventSuffix; let eventType = "popup" + aEventSuffix;
function onPopupEvent(e) { function onPopupEvent(e) {

View File

@ -114,7 +114,7 @@ BrowserAction.prototype = {
}); });
this.tabContext.on("tab-select", // eslint-disable-line mozilla/balanced-listeners this.tabContext.on("tab-select", // eslint-disable-line mozilla/balanced-listeners
(evt, tab) => { this.updateWindow(tab.ownerDocument.defaultView); }); (evt, tab) => { this.updateWindow(tab.ownerGlobal); });
this.widget = widget; this.widget = widget;
}, },
@ -196,7 +196,7 @@ BrowserAction.prototype = {
updateOnChange(tab) { updateOnChange(tab) {
if (tab) { if (tab) {
if (tab.selected) { if (tab.selected) {
this.updateWindow(tab.ownerDocument.defaultView); this.updateWindow(tab.ownerGlobal);
} }
} else { } else {
for (let window of WindowListManager.browserWindows()) { for (let window of WindowListManager.browserWindows()) {

View File

@ -124,7 +124,7 @@ CommandList.prototype = {
// therefore the listeners for these elements will be garbage collected. // therefore the listeners for these elements will be garbage collected.
keyElement.addEventListener("command", (event) => { keyElement.addEventListener("command", (event) => {
if (name == "_execute_page_action") { if (name == "_execute_page_action") {
let win = event.target.ownerDocument.defaultView; let win = event.target.ownerGlobal;
pageActionFor(this.extension).triggerAction(win); pageActionFor(this.extension).triggerAction(win);
} else { } else {
this.emit("command", name); this.emit("command", name);

View File

@ -51,7 +51,7 @@ var gMenuBuilder = {
// Display the extension icon on the root element. // Display the extension icon on the root element.
if (root.extension.manifest.icons) { if (root.extension.manifest.icons) {
let parentWindow = contextData.menu.ownerDocument.defaultView; let parentWindow = contextData.menu.ownerGlobal;
let extension = root.extension; let extension = root.extension;
let {icon} = IconDetails.getPreferredIcon(extension.manifest.icons, extension, let {icon} = IconDetails.getPreferredIcon(extension.manifest.icons, extension,

View File

@ -64,7 +64,7 @@ PageAction.prototype = {
} }
if (tab.selected) { if (tab.selected) {
this.updateButton(tab.ownerDocument.defaultView); this.updateButton(tab.ownerGlobal);
} }
}, },
@ -183,7 +183,7 @@ PageAction.prototype = {
if (fromBrowse) { if (fromBrowse) {
this.tabContext.clear(tab); this.tabContext.clear(tab);
} }
this.updateButton(tab.ownerDocument.defaultView); this.updateButton(tab.ownerGlobal);
}, },
shutdown() { shutdown() {

View File

@ -26,7 +26,7 @@ function getSender(context, target, sender) {
// We can just get the |tab| from |target|. // We can just get the |tab| from |target|.
if (target instanceof Ci.nsIDOMXULElement) { if (target instanceof Ci.nsIDOMXULElement) {
// The message came from a content script. // The message came from a content script.
let tabbrowser = target.ownerDocument.defaultView.gBrowser; let tabbrowser = target.ownerGlobal.gBrowser;
if (!tabbrowser) { if (!tabbrowser) {
return; return;
} }
@ -54,7 +54,7 @@ extensions.on("page-load", (type, page, params, sender, delegate) => {
if (params.type == "tab" || params.type == "popup") { if (params.type == "tab" || params.type == "popup") {
let browser = params.docShell.chromeEventHandler; let browser = params.docShell.chromeEventHandler;
let parentWindow = browser.ownerDocument.defaultView; let parentWindow = browser.ownerGlobal;
page.windowId = WindowManager.getId(parentWindow); page.windowId = WindowManager.getId(parentWindow);
let tab = parentWindow.gBrowser.getTabForBrowser(browser); let tab = parentWindow.gBrowser.getTabForBrowser(browser);
@ -206,14 +206,14 @@ let tabListener = {
}, },
emitAttached(tab) { emitAttached(tab) {
let newWindowId = WindowManager.getId(tab.ownerDocument.defaultView); let newWindowId = WindowManager.getId(tab.ownerGlobal);
let tabId = TabManager.getId(tab); let tabId = TabManager.getId(tab);
this.emit("tab-attached", {tab, tabId, newWindowId, newPosition: tab._tPos}); this.emit("tab-attached", {tab, tabId, newWindowId, newPosition: tab._tPos});
}, },
emitDetached(tab, adoptedBy) { emitDetached(tab, adoptedBy) {
let oldWindowId = WindowManager.getId(tab.ownerDocument.defaultView); let oldWindowId = WindowManager.getId(tab.ownerGlobal);
let tabId = TabManager.getId(tab); let tabId = TabManager.getId(tab);
this.emit("tab-detached", {tab, adoptedBy, tabId, oldWindowId, oldPosition: tab._tPos}); this.emit("tab-detached", {tab, adoptedBy, tabId, oldWindowId, oldPosition: tab._tPos});
@ -224,7 +224,7 @@ let tabListener = {
}, },
emitRemoved(tab, isWindowClosing) { emitRemoved(tab, isWindowClosing) {
let windowId = WindowManager.getId(tab.ownerDocument.defaultView); let windowId = WindowManager.getId(tab.ownerGlobal);
let tabId = TabManager.getId(tab); let tabId = TabManager.getId(tab);
this.emit("tab-removed", {tab, tabId, windowId, isWindowClosing}); this.emit("tab-removed", {tab, tabId, windowId, isWindowClosing});
@ -243,7 +243,7 @@ let tabListener = {
onLocationChange(browser, webProgress, request, locationURI, flags) { onLocationChange(browser, webProgress, request, locationURI, flags) {
if (webProgress.isTopLevel) { if (webProgress.isTopLevel) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser; let gBrowser = browser.ownerGlobal.gBrowser;
let tab = gBrowser.getTabForBrowser(browser); let tab = gBrowser.getTabForBrowser(browser);
let deferred = this.tabReadyPromises.get(tab); let deferred = this.tabReadyPromises.get(tab);
@ -267,7 +267,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
onActivated: new WindowEventManager(context, "tabs.onActivated", "TabSelect", (fire, event) => { onActivated: new WindowEventManager(context, "tabs.onActivated", "TabSelect", (fire, event) => {
let tab = event.originalTarget; let tab = event.originalTarget;
let tabId = TabManager.getId(tab); let tabId = TabManager.getId(tab);
let windowId = WindowManager.getId(tab.ownerDocument.defaultView); let windowId = WindowManager.getId(tab.ownerGlobal);
fire({tabId, windowId}); fire({tabId, windowId});
}).api(), }).api(),
@ -292,7 +292,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
onHighlighted: new WindowEventManager(context, "tabs.onHighlighted", "TabSelect", (fire, event) => { onHighlighted: new WindowEventManager(context, "tabs.onHighlighted", "TabSelect", (fire, event) => {
let tab = event.originalTarget; let tab = event.originalTarget;
let tabIds = [TabManager.getId(tab)]; let tabIds = [TabManager.getId(tab)];
let windowId = WindowManager.getId(tab.ownerDocument.defaultView); let windowId = WindowManager.getId(tab.ownerGlobal);
fire({tabIds, windowId}); fire({tabIds, windowId});
}).api(), }).api(),
@ -363,7 +363,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
} }
fire(TabManager.getId(tab), { fire(TabManager.getId(tab), {
windowId: WindowManager.getId(tab.ownerDocument.defaultView), windowId: WindowManager.getId(tab.ownerGlobal),
fromIndex: event.detail, fromIndex: event.detail,
toIndex: tab._tPos, toIndex: tab._tPos,
}); });
@ -393,7 +393,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
let fireForBrowser = (browser, changed) => { let fireForBrowser = (browser, changed) => {
let [needed, changeInfo] = sanitize(extension, changed); let [needed, changeInfo] = sanitize(extension, changed);
if (needed) { if (needed) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser; let gBrowser = browser.ownerGlobal.gBrowser;
let tabElem = gBrowser.getTabForBrowser(browser); let tabElem = gBrowser.getTabForBrowser(browser);
let tab = TabManager.convert(extension, tabElem); let tab = TabManager.convert(extension, tabElem);
@ -550,7 +550,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
for (let tabId of tabs) { for (let tabId of tabs) {
let tab = TabManager.getTab(tabId); let tab = TabManager.getTab(tabId);
tab.ownerDocument.defaultView.gBrowser.removeTab(tab); tab.ownerGlobal.gBrowser.removeTab(tab);
} }
return Promise.resolve(); return Promise.resolve();
@ -563,7 +563,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
return Promise.reject({message: `No tab found with tabId: ${tabId}`}); return Promise.reject({message: `No tab found with tabId: ${tabId}`});
} }
let tabbrowser = tab.ownerDocument.defaultView.gBrowser; let tabbrowser = tab.ownerGlobal.gBrowser;
if (updateProperties.url !== null) { if (updateProperties.url !== null) {
let url = context.uri.resolve(updateProperties.url); let url = context.uri.resolve(updateProperties.url);
@ -881,7 +881,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
} }
// If the window is not specified, use the window from the tab. // If the window is not specified, use the window from the tab.
let window = destinationWindow || tab.ownerDocument.defaultView; let window = destinationWindow || tab.ownerGlobal;
let gBrowser = window.gBrowser; let gBrowser = window.gBrowser;
let insertionPoint = indexMap.get(window) || index; let insertionPoint = indexMap.get(window) || index;
@ -902,7 +902,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
indexMap.set(window, insertionPoint + 1); indexMap.set(window, insertionPoint + 1);
if (tab.ownerDocument.defaultView !== window) { if (tab.ownerGlobal != window) {
// If the window we are moving the tab in is different, then move the tab // If the window we are moving the tab in is different, then move the tab
// to the new window. // to the new window.
tab = gBrowser.adoptTab(tab, insertionPoint, false); tab = gBrowser.adoptTab(tab, insertionPoint, false);
@ -922,7 +922,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
return Promise.reject({message: `Invalid tab ID: ${tabId}`}); return Promise.reject({message: `Invalid tab ID: ${tabId}`});
} }
let gBrowser = tab.ownerDocument.defaultView.gBrowser; let gBrowser = tab.ownerGlobal.gBrowser;
let newTab = gBrowser.duplicateTab(tab); let newTab = gBrowser.duplicateTab(tab);
return new Promise(resolve => { return new Promise(resolve => {
@ -952,7 +952,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
getZoom(tabId) { getZoom(tabId) {
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab; let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
let {ZoomManager} = tab.ownerDocument.defaultView; let {ZoomManager} = tab.ownerGlobal;
let zoom = ZoomManager.getZoomForBrowser(tab.linkedBrowser); let zoom = ZoomManager.getZoomForBrowser(tab.linkedBrowser);
return Promise.resolve(zoom); return Promise.resolve(zoom);
@ -961,7 +961,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
setZoom(tabId, zoom) { setZoom(tabId, zoom) {
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab; let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
let {FullZoom, ZoomManager} = tab.ownerDocument.defaultView; let {FullZoom, ZoomManager} = tab.ownerGlobal;
if (zoom === 0) { if (zoom === 0) {
// A value of zero means use the default zoom factor. // A value of zero means use the default zoom factor.
@ -980,7 +980,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
_getZoomSettings(tabId) { _getZoomSettings(tabId) {
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab; let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
let {FullZoom} = tab.ownerDocument.defaultView; let {FullZoom} = tab.ownerGlobal;
return { return {
mode: "automatic", mode: "automatic",
@ -1006,7 +1006,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
onZoomChange: new EventManager(context, "tabs.onZoomChange", fire => { onZoomChange: new EventManager(context, "tabs.onZoomChange", fire => {
let getZoomLevel = browser => { let getZoomLevel = browser => {
let {ZoomManager} = browser.ownerDocument.defaultView; let {ZoomManager} = browser.ownerGlobal;
return ZoomManager.getZoomForBrowser(browser); return ZoomManager.getZoomForBrowser(browser);
}; };
@ -1040,7 +1040,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
.chromeEventHandler; .chromeEventHandler;
} }
let {gBrowser} = browser.ownerDocument.defaultView; let {gBrowser} = browser.ownerGlobal;
let tab = gBrowser.getTabForBrowser(browser); let tab = gBrowser.getTabForBrowser(browser);
if (!tab) { if (!tab) {
// We only care about zoom events in the top-level browser of a tab. // We only care about zoom events in the top-level browser of a tab.

View File

@ -73,7 +73,7 @@ class BasePopup {
this.popupURI = popupURI; this.popupURI = popupURI;
this.viewNode = viewNode; this.viewNode = viewNode;
this.browserStyle = browserStyle; this.browserStyle = browserStyle;
this.window = viewNode.ownerDocument.defaultView; this.window = viewNode.ownerGlobal;
this.contentReady = new Promise(resolve => { this.contentReady = new Promise(resolve => {
this._resolveContentReady = resolve; this._resolveContentReady = resolve;
@ -328,7 +328,7 @@ TabContext.prototype = {
}, },
onLocationChange(browser, webProgress, request, locationURI, flags) { onLocationChange(browser, webProgress, request, locationURI, flags) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser; let gBrowser = browser.ownerGlobal.gBrowser;
if (browser === gBrowser.selectedBrowser) { if (browser === gBrowser.selectedBrowser) {
let tab = gBrowser.getTabForBrowser(browser); let tab = gBrowser.getTabForBrowser(browser);
this.emit("location-change", tab, true); this.emit("location-change", tab, true);
@ -384,7 +384,7 @@ ExtensionTabManager.prototype = {
}, },
convert(tab) { convert(tab) {
let window = tab.ownerDocument.defaultView; let window = tab.ownerGlobal;
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
let mutedInfo = {muted: tab.muted}; let mutedInfo = {muted: tab.muted};
@ -495,7 +495,7 @@ global.TabManager = {
}, },
getBrowserId(browser) { getBrowserId(browser) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser; let gBrowser = browser.ownerGlobal.gBrowser;
// Some non-browser windows have gBrowser but not // Some non-browser windows have gBrowser but not
// getTabForBrowser! // getTabForBrowser!
if (gBrowser && gBrowser.getTabForBrowser) { if (gBrowser && gBrowser.getTabForBrowser) {

View File

@ -71,7 +71,7 @@ SearchProvider.prototype = {
}, },
manageEngines(browser) { manageEngines(browser) {
const browserWin = browser.ownerDocument.defaultView; const browserWin = browser.ownerGlobal;
browserWin.openPreferences("paneSearch"); browserWin.openPreferences("paneSearch");
}, },

View File

@ -2557,7 +2557,7 @@ ContentPermissionPrompt.prototype = {
_showPrompt: function CPP_showPrompt(aRequest, aMessage, aPermission, aActions, _showPrompt: function CPP_showPrompt(aRequest, aMessage, aPermission, aActions,
aNotificationId, aAnchorId, aOptions) { aNotificationId, aAnchorId, aOptions) {
var browser = this._getBrowserForRequest(aRequest); var browser = this._getBrowserForRequest(aRequest);
var chromeWin = browser.ownerDocument.defaultView; var chromeWin = browser.ownerGlobal;
var requestPrincipal = aRequest.principal; var requestPrincipal = aRequest.principal;
// Transform the prompt actions into PopupNotification actions. // Transform the prompt actions into PopupNotification actions.
@ -2760,7 +2760,7 @@ ContentPermissionPrompt.prototype = {
} }
var browser = this._getBrowserForRequest(request); var browser = this._getBrowserForRequest(request);
var chromeWin = browser.ownerDocument.defaultView; var chromeWin = browser.ownerGlobal;
if (!chromeWin.PopupNotifications) if (!chromeWin.PopupNotifications)
// Ignore requests from browsers hosted in windows that don't support // Ignore requests from browsers hosted in windows that don't support
// PopupNotifications. // PopupNotifications.

View File

@ -186,7 +186,7 @@ let InternalFaviconLoader = {
loadFavicon(browser, principal, uri) { loadFavicon(browser, principal, uri) {
this.ensureInitialized(); this.ensureInitialized();
let win = browser.ownerDocument.defaultView; let win = browser.ownerGlobal;
if (!gFaviconLoadDataMap.has(win)) { if (!gFaviconLoadDataMap.has(win)) {
gFaviconLoadDataMap.set(win, []); gFaviconLoadDataMap.set(win, []);
let unloadHandler = event => { let unloadHandler = event => {

View File

@ -1601,7 +1601,7 @@ var PlacesControllerDragHelper = {
unwrapped = PlacesUtils.unwrapNodes(data, flavor)[0]; unwrapped = PlacesUtils.unwrapNodes(data, flavor)[0];
} }
else if (data instanceof XULElement && data.localName == "tab" && else if (data instanceof XULElement && data.localName == "tab" &&
data.ownerDocument.defaultView instanceof ChromeWindow) { data.ownerGlobal instanceof ChromeWindow) {
let uri = data.linkedBrowser.currentURI; let uri = data.linkedBrowser.currentURI;
let spec = uri ? uri.spec : "about:blank"; let spec = uri ? uri.spec : "about:blank";
let title = data.label; let title = data.label;

View File

@ -28,7 +28,7 @@ var gTabsListener = {
} }
var tab = aEvent.target; var tab = aEvent.target;
is(tab.ownerDocument.defaultView, window, is(tab.ownerGlobal, window,
"Tab has been opened in current browser window"); "Tab has been opened in current browser window");
}, },
@ -62,7 +62,7 @@ var gTabsListener = {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
// Test finished. This will move to the next one. // Test finished. This will move to the next one.
waitForFocus(gCurrentTest.finish, gBrowser.ownerDocument.defaultView); waitForFocus(gCurrentTest.finish, gBrowser.ownerGlobal);
}); });
} }
} }

View File

@ -136,7 +136,7 @@ function synthesizeClickOnSelectedTreeCell(aTree, aOptions) {
var y = rect.y + rect.height / 2; var y = rect.y + rect.height / 2;
// Simulate the click. // Simulate the click.
EventUtils.synthesizeMouse(aTree.body, x, y, aOptions || {}, EventUtils.synthesizeMouse(aTree.body, x, y, aOptions || {},
aTree.ownerDocument.defaultView); aTree.ownerGlobal);
} }
/** /**

View File

@ -336,7 +336,7 @@ var gSubDialog = {
(isLastFocusableElement(aEvent.originalTarget) && forward)) { (isLastFocusableElement(aEvent.originalTarget) && forward)) {
aEvent.preventDefault(); aEvent.preventDefault();
aEvent.stopImmediatePropagation(); aEvent.stopImmediatePropagation();
let parentWin = this._getBrowser().ownerDocument.defaultView; let parentWin = this._getBrowser().ownerGlobal;
if (forward) { if (forward) {
fm.moveFocus(parentWin, null, fm.MOVEFOCUS_FIRST, fm.FLAG_BYKEY); fm.moveFocus(parentWin, null, fm.MOVEFOCUS_FIRST, fm.FLAG_BYKEY);
} else { } else {

View File

@ -6,7 +6,7 @@ Components.utils.import("resource://gre/modules/Promise.jsm");
const kDefaultWait = 2000; const kDefaultWait = 2000;
function is_hidden(aElement) { function is_hidden(aElement) {
var style = aElement.ownerDocument.defaultView.getComputedStyle(aElement, ""); var style = aElement.ownerGlobal.getComputedStyle(aElement);
if (style.display == "none") if (style.display == "none")
return true; return true;
if (style.visibility != "visible") if (style.visibility != "visible")

View File

@ -32,10 +32,10 @@ add_task(function* testNormalBrowsing() {
info("Load a test page that's whitelisted"); info("Load a test page that's whitelisted");
Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, "example.com,www.ItIsaTrap.org,example.net"); Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, "example.com,www.ItIsaTrap.org,example.net");
yield promiseTabLoadEvent(tab, TEST_PAGE, "load"); yield promiseTabLoadEvent(tab, TEST_PAGE, "load");
testWhitelistedPage(tab.ownerDocument.defaultView); testWhitelistedPage(tab.ownerGlobal);
info("Load a test page that's no longer whitelisted"); info("Load a test page that's no longer whitelisted");
Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, ""); Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, "");
yield promiseTabLoadEvent(tab, TEST_PAGE, "AboutBlockedLoaded"); yield promiseTabLoadEvent(tab, TEST_PAGE, "AboutBlockedLoaded");
testBlockedPage(tab.ownerDocument.defaultView); testBlockedPage(tab.ownerGlobal);
}); });

View File

@ -49,7 +49,7 @@ const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
const scale = utils.screenPixelsPerCSSPixel; const scale = utils.screenPixelsPerCSSPixel;
function* synthesizeNativeMouseMove(aElement) { function* synthesizeNativeMouseMove(aElement) {
let rect = aElement.getBoundingClientRect(); let rect = aElement.getBoundingClientRect();
let win = aElement.ownerDocument.defaultView; let win = aElement.ownerGlobal;
let x = win.mozInnerScreenX + (rect.left + rect.right) / 2; let x = win.mozInnerScreenX + (rect.left + rect.right) / 2;
let y = win.mozInnerScreenY + (rect.top + rect.bottom) / 2; let y = win.mozInnerScreenY + (rect.top + rect.bottom) / 2;

View File

@ -24,7 +24,7 @@ const scale = utils.screenPixelsPerCSSPixel;
function* synthesizeNativeMouseClick(aElement) { function* synthesizeNativeMouseClick(aElement) {
let rect = aElement.getBoundingClientRect(); let rect = aElement.getBoundingClientRect();
let win = aElement.ownerDocument.defaultView; let win = aElement.ownerGlobal;
let x = win.mozInnerScreenX + (rect.left + rect.right) / 2; let x = win.mozInnerScreenX + (rect.left + rect.right) / 2;
let y = win.mozInnerScreenY + (rect.top + rect.bottom) / 2; let y = win.mozInnerScreenY + (rect.top + rect.bottom) / 2;

View File

@ -677,7 +677,7 @@ var SessionStoreInternal = {
// If we got here, that means we're dealing with a frame message // If we got here, that means we're dealing with a frame message
// manager message, so the target will be a <xul:browser>. // manager message, so the target will be a <xul:browser>.
var browser = aMessage.target; var browser = aMessage.target;
let win = browser.ownerDocument.defaultView; let win = browser.ownerGlobal;
let tab = win ? win.gBrowser.getTabForBrowser(browser) : null; let tab = win ? win.gBrowser.getTabForBrowser(browser) : null;
// Ensure we receive only specific messages from <xul:browser>s that // Ensure we receive only specific messages from <xul:browser>s that
@ -890,7 +890,7 @@ var SessionStoreInternal = {
* Implement nsIDOMEventListener for handling various window and tab events * Implement nsIDOMEventListener for handling various window and tab events
*/ */
handleEvent: function ssi_handleEvent(aEvent) { handleEvent: function ssi_handleEvent(aEvent) {
let win = aEvent.currentTarget.ownerDocument.defaultView; let win = aEvent.currentTarget.ownerGlobal;
let target = aEvent.originalTarget; let target = aEvent.originalTarget;
switch (aEvent.type) { switch (aEvent.type) {
case "TabOpen": case "TabOpen":
@ -2051,7 +2051,7 @@ var SessionStoreInternal = {
}, },
getTabState: function ssi_getTabState(aTab) { getTabState: function ssi_getTabState(aTab) {
if (!aTab.ownerDocument.defaultView.__SSi) { if (!aTab.ownerGlobal.__SSi) {
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG); throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
} }
@ -2076,7 +2076,7 @@ var SessionStoreInternal = {
throw Components.Exception("Invalid state object: no entries", Cr.NS_ERROR_INVALID_ARG); throw Components.Exception("Invalid state object: no entries", Cr.NS_ERROR_INVALID_ARG);
} }
let window = aTab.ownerDocument.defaultView; let window = aTab.ownerGlobal;
if (!("__SSi" in window)) { if (!("__SSi" in window)) {
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG); throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
} }
@ -2089,7 +2089,7 @@ var SessionStoreInternal = {
}, },
duplicateTab: function ssi_duplicateTab(aWindow, aTab, aDelta = 0) { duplicateTab: function ssi_duplicateTab(aWindow, aTab, aDelta = 0) {
if (!aTab.ownerDocument.defaultView.__SSi) { if (!aTab.ownerGlobal.__SSi) {
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG); throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
} }
if (!aWindow.gBrowser) { if (!aWindow.gBrowser) {
@ -2118,7 +2118,7 @@ var SessionStoreInternal = {
return; return;
} }
let window = newTab.ownerDocument && newTab.ownerDocument.defaultView; let window = newTab.ownerGlobal;
// The tab or its window might be gone. // The tab or its window might be gone.
if (!window || !window.__SSi) { if (!window || !window.__SSi) {
@ -2305,13 +2305,13 @@ var SessionStoreInternal = {
} }
aTab.__SS_extdata[aKey] = aStringValue; aTab.__SS_extdata[aKey] = aStringValue;
this.saveStateDelayed(aTab.ownerDocument.defaultView); this.saveStateDelayed(aTab.ownerGlobal);
}, },
deleteTabValue: function ssi_deleteTabValue(aTab, aKey) { deleteTabValue: function ssi_deleteTabValue(aTab, aKey) {
if (aTab.__SS_extdata && aKey in aTab.__SS_extdata) { if (aTab.__SS_extdata && aKey in aTab.__SS_extdata) {
delete aTab.__SS_extdata[aKey]; delete aTab.__SS_extdata[aKey];
this.saveStateDelayed(aTab.ownerDocument.defaultView); this.saveStateDelayed(aTab.ownerGlobal);
} }
}, },
@ -2509,7 +2509,7 @@ var SessionStoreInternal = {
* flush has finished. * flush has finished.
*/ */
navigateAndRestore(tab, loadArguments, historyIndex) { navigateAndRestore(tab, loadArguments, historyIndex) {
let window = tab.ownerDocument.defaultView; let window = tab.ownerGlobal;
NS_ASSERT(window.__SSi, "tab's window must be tracked"); NS_ASSERT(window.__SSi, "tab's window must be tracked");
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
@ -2547,7 +2547,7 @@ var SessionStoreInternal = {
return; return;
} }
let window = tab.ownerDocument && tab.ownerDocument.defaultView; let window = tab.ownerGlobal;
// The tab or its window might be gone. // The tab or its window might be gone.
if (!window || !window.__SSi || window.closed) { if (!window || !window.__SSi || window.closed) {
@ -3210,7 +3210,7 @@ var SessionStoreInternal = {
let restoreImmediately = options.restoreImmediately; let restoreImmediately = options.restoreImmediately;
let loadArguments = options.loadArguments; let loadArguments = options.loadArguments;
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
let window = tab.ownerDocument.defaultView; let window = tab.ownerGlobal;
let tabbrowser = window.gBrowser; let tabbrowser = window.gBrowser;
let forceOnDemand = options.forceOnDemand; let forceOnDemand = options.forceOnDemand;
@ -3350,7 +3350,7 @@ var SessionStoreInternal = {
} }
let browser = aTab.linkedBrowser; let browser = aTab.linkedBrowser;
let window = aTab.ownerDocument.defaultView; let window = aTab.ownerGlobal;
let tabbrowser = window.gBrowser; let tabbrowser = window.gBrowser;
let tabData = TabState.clone(aTab); let tabData = TabState.clone(aTab);
let activeIndex = tabData.index - 1; let activeIndex = tabData.index - 1;
@ -4145,7 +4145,7 @@ var SessionStoreInternal = {
NS_ASSERT(aTab.linkedBrowser.__SS_restoreState, NS_ASSERT(aTab.linkedBrowser.__SS_restoreState,
"given tab is not restoring"); "given tab is not restoring");
let window = aTab.ownerDocument.defaultView; let window = aTab.ownerGlobal;
let browser = aTab.linkedBrowser; let browser = aTab.linkedBrowser;
// Keep the tab's previous state for later in this method // Keep the tab's previous state for later in this method

View File

@ -118,7 +118,7 @@ var TabStateInternal = {
// Store the tab icon. // Store the tab icon.
if (!("image" in tabData)) { if (!("image" in tabData)) {
let tabbrowser = tab.ownerDocument.defaultView.gBrowser; let tabbrowser = tab.ownerGlobal.gBrowser;
tabData.image = tabbrowser.getIcon(tab); tabData.image = tabbrowser.getIcon(tab);
} }

View File

@ -418,8 +418,7 @@ var FormDataListener = {
handleEvent: function (event) { handleEvent: function (event) {
let frame = event.target && let frame = event.target &&
event.target.ownerDocument && event.target.ownerGlobal;
event.target.ownerDocument.defaultView;
// Don't collect form data for frames created at or after the load event // Don't collect form data for frames created at or after the load event
// as SessionStore can't restore form data for those. // as SessionStore can't restore form data for those.

View File

@ -18,7 +18,7 @@ add_task(function* () {
aTextField.value = aValue; aTextField.value = aValue;
let event = aTextField.ownerDocument.createEvent("UIEvents"); let event = aTextField.ownerDocument.createEvent("UIEvents");
event.initUIEvent("input", true, true, aTextField.ownerDocument.defaultView, 0); event.initUIEvent("input", true, true, aTextField.ownerGlobal, 0);
aTextField.dispatchEvent(event); aTextField.dispatchEvent(event);
} }

View File

@ -77,7 +77,7 @@ function* openTabInUserContext(userContextId) {
// Select tab and make sure its browser is focused. // Select tab and make sure its browser is focused.
gBrowser.selectedTab = tab; gBrowser.selectedTab = tab;
tab.ownerDocument.defaultView.focus(); tab.ownerGlobal.focus();
let browser = gBrowser.getBrowserForTab(tab); let browser = gBrowser.getBrowserForTab(tab);
yield BrowserTestUtils.browserLoaded(browser); yield BrowserTestUtils.browserLoaded(browser);

View File

@ -38,7 +38,7 @@ function queryElement(data) {
function dispatchUIEvent(input, type) { function dispatchUIEvent(input, type) {
let event = input.ownerDocument.createEvent("UIEvents"); let event = input.ownerDocument.createEvent("UIEvents");
event.initUIEvent(type, true, true, input.ownerDocument.defaultView, 0); event.initUIEvent(type, true, true, input.ownerGlobal, 0);
input.dispatchEvent(event); input.dispatchEvent(event);
} }

View File

@ -368,7 +368,7 @@ function* testContextMenu(syncedTabsDeckComponent, contextSelector, triggerSelec
let promisePopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown"); let promisePopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
let chromeWindow = triggerElement.ownerDocument.defaultView.top; let chromeWindow = triggerElement.ownerGlobal.top;
let rect = triggerElement.getBoundingClientRect(); let rect = triggerElement.getBoundingClientRect();
let contentRect = chromeWindow.SidebarUI.browser.getBoundingClientRect(); let contentRect = chromeWindow.SidebarUI.browser.getBoundingClientRect();
// The offsets in `rect` are relative to the content window, but // The offsets in `rect` are relative to the content window, but

View File

@ -364,7 +364,7 @@ this.UITour = {
onPageEvent: function(aMessage, aEvent) { onPageEvent: function(aMessage, aEvent) {
let browser = aMessage.target; let browser = aMessage.target;
let window = browser.ownerDocument.defaultView; let window = browser.ownerGlobal;
// Does the window have tabs? We need to make sure since windowless browsers do // Does the window have tabs? We need to make sure since windowless browsers do
// not have tabs. // not have tabs.
@ -721,7 +721,7 @@ this.UITour = {
// was generated originally. If the browser where the UI tour is loaded // was generated originally. If the browser where the UI tour is loaded
// is windowless, just ignore the request to close the tab. The request // is windowless, just ignore the request to close the tab. The request
// is also ignored if this is the only tab in the window. // is also ignored if this is the only tab in the window.
let tabBrowser = browser.ownerDocument.defaultView.gBrowser; let tabBrowser = browser.ownerGlobal.gBrowser;
if (tabBrowser && tabBrowser.browsers.length > 1) { if (tabBrowser && tabBrowser.browsers.length > 1) {
tabBrowser.removeTab(tabBrowser.getTabForBrowser(browser)); tabBrowser.removeTab(tabBrowser.getTabForBrowser(browser));
} }
@ -755,7 +755,7 @@ this.UITour = {
log.debug("handleEvent: type =", aEvent.type, "event =", aEvent); log.debug("handleEvent: type =", aEvent.type, "event =", aEvent);
switch (aEvent.type) { switch (aEvent.type) {
case "TabSelect": { case "TabSelect": {
let window = aEvent.target.ownerDocument.defaultView; let window = aEvent.target.ownerGlobal;
// Teardown the browser of the tab we just switched away from. // Teardown the browser of the tab we just switched away from.
if (aEvent.detail && aEvent.detail.previousTab) { if (aEvent.detail && aEvent.detail.previousTab) {
@ -972,7 +972,7 @@ this.UITour = {
}, },
isElementVisible: function(aElement) { isElementVisible: function(aElement) {
let targetStyle = aElement.ownerDocument.defaultView.getComputedStyle(aElement); let targetStyle = aElement.ownerGlobal.getComputedStyle(aElement);
return !aElement.ownerDocument.hidden && return !aElement.ownerDocument.hidden &&
targetStyle.display != "none" && targetStyle.display != "none" &&
targetStyle.visibility == "visible"; targetStyle.visibility == "visible";
@ -1825,7 +1825,7 @@ this.UITour = {
}, },
hideAnnotationsForPanel: function(aEvent, aTargetPositionCallback) { hideAnnotationsForPanel: function(aEvent, aTargetPositionCallback) {
let win = aEvent.target.ownerDocument.defaultView; let win = aEvent.target.ownerGlobal;
let annotationElements = new Map([ let annotationElements = new Map([
// [annotationElement (panel), method to hide the annotation] // [annotationElement (panel), method to hide the annotation]
[win.document.getElementById("UITourHighlightContainer"), UITour.hideHighlight.bind(UITour)], [win.document.getElementById("UITourHighlightContainer"), UITour.hideHighlight.bind(UITour)],
@ -2063,7 +2063,7 @@ this.UITour = {
if (observer) { if (observer) {
return; return;
} }
let win = aPanelEl.ownerDocument.defaultView; let win = aPanelEl.ownerGlobal;
observer = new win.MutationObserver(this._annotationMutationCallback); observer = new win.MutationObserver(this._annotationMutationCallback);
this._annotationPanelMutationObservers.set(aPanelEl, observer); this._annotationPanelMutationObservers.set(aPanelEl, observer);
let observerOptions = { let observerOptions = {

View File

@ -54,7 +54,7 @@ function taskify(fun) {
} }
function is_hidden(element) { function is_hidden(element) {
var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") if (style.display == "none")
return true; return true;
if (style.visibility != "visible") if (style.visibility != "visible")
@ -70,7 +70,7 @@ function is_hidden(element) {
} }
function is_visible(element) { function is_visible(element) {
var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") if (style.display == "none")
return false; return false;
if (style.visibility != "visible") if (style.visibility != "visible")
@ -223,7 +223,7 @@ function is_element_hidden(element, msg) {
} }
function isTourBrowser(aBrowser) { function isTourBrowser(aBrowser) {
let chromeWindow = aBrowser.ownerDocument.defaultView; let chromeWindow = aBrowser.ownerGlobal;
return UITour.tourBrowsersByWindow.has(chromeWindow) && return UITour.tourBrowsersByWindow.has(chromeWindow) &&
UITour.tourBrowsersByWindow.get(chromeWindow).has(aBrowser); UITour.tourBrowsersByWindow.get(chromeWindow).has(aBrowser);
} }

View File

@ -65,7 +65,7 @@ var Pocket = {
}, },
onPanelViewHiding(event) { onPanelViewHiding(event) {
let window = event.target.ownerDocument.defaultView; let window = event.target.ownerGlobal;
window.pktUI.pocketPanelDidHide(event); window.pktUI.pocketPanelDidHide(event);
}, },

View File

@ -110,7 +110,7 @@ var AboutHome = {
}, },
receiveMessage: function(aMessage) { receiveMessage: function(aMessage) {
let window = aMessage.target.ownerDocument.defaultView; let window = aMessage.target.ownerGlobal;
switch (aMessage.name) { switch (aMessage.name) {
case "AboutHome:RestorePreviousSession": case "AboutHome:RestorePreviousSession":

View File

@ -165,7 +165,7 @@ this.CaptivePortalWatcher = {
return; return;
} }
let tabbrowser = tab.ownerDocument.defaultView.gBrowser; let tabbrowser = tab.ownerGlobal.gBrowser;
// If after the login, the captive portal has redirected to some other page, // If after the login, the captive portal has redirected to some other page,
// leave it open if the tab has focus. // leave it open if the tab has focus.

View File

@ -79,7 +79,7 @@ var CastingApps = {
if (!app) if (!app)
return; return;
video.title = videoElement.ownerDocument.defaultView.top.document.title; video.title = videoElement.ownerGlobal.top.document.title;
if (video.element) { if (video.element) {
// If the video is currently playing on the device, pause it // If the video is currently playing on the device, pause it
if (!video.element.paused) { if (!video.element.paused) {

View File

@ -32,7 +32,7 @@ var ContentClick = {
contentAreaClick: function (json, browser) { contentAreaClick: function (json, browser) {
// This is heavily based on contentAreaClick from browser.js (Bug 903016) // This is heavily based on contentAreaClick from browser.js (Bug 903016)
// The json is set up in a way to look like an Event. // The json is set up in a way to look like an Event.
let window = browser.ownerDocument.defaultView; let window = browser.ownerGlobal;
if (!json.href) { if (!json.href) {
// Might be middle mouse navigation. // Might be middle mouse navigation.

View File

@ -79,7 +79,7 @@ this.TabCrashHandler = {
receiveMessage: function(message) { receiveMessage: function(message) {
let browser = message.target.browser; let browser = message.target.browser;
let gBrowser = browser.ownerDocument.defaultView.gBrowser; let gBrowser = browser.ownerGlobal.gBrowser;
let tab = gBrowser.getTabForBrowser(browser); let tab = gBrowser.getTabForBrowser(browser);
switch(message.name) { switch(message.name) {

View File

@ -43,7 +43,7 @@ this.ContentLinkHandler = {
return; return;
// Ignore sub-frames (bugs 305472, 479408). // Ignore sub-frames (bugs 305472, 479408).
let window = link.ownerDocument.defaultView; let window = link.ownerGlobal;
if (window != window.top) if (window != window.top)
return; return;

View File

@ -230,17 +230,12 @@ this.ContentSearch = {
let engine = Services.search.getEngineByName(data.engineName); let engine = Services.search.getEngineByName(data.engineName);
let submission = engine.getSubmission(data.searchString, "", data.searchPurpose); let submission = engine.getSubmission(data.searchString, "", data.searchPurpose);
let browser = msg.target; let browser = msg.target;
let win; let win = browser.ownerGlobal;
try { if (!win) {
win = browser.ownerDocument.defaultView;
}
catch (err) {
// The browser may have been closed between the time its content sent the // The browser may have been closed between the time its content sent the
// message and the time we handle it. In that case, trying to call any // message and the time we handle it.
// method on it will throw.
return; return;
} }
let where = win.whereToOpenLink(data.originalEvent); let where = win.whereToOpenLink(data.originalEvent);
// There is a chance that by the time we receive the search message, the user // There is a chance that by the time we receive the search message, the user
@ -424,7 +419,7 @@ this.ContentSearch = {
}, },
_onMessageManageEngines: function (msg, data) { _onMessageManageEngines: function (msg, data) {
let browserWin = msg.target.ownerDocument.defaultView; let browserWin = msg.target.ownerGlobal;
browserWin.openPreferences("paneSearch"); browserWin.openPreferences("paneSearch");
}, },

View File

@ -107,7 +107,7 @@ FormSubmitObserver.prototype =
// Insure that this is the FormSubmitObserver associated with the // Insure that this is the FormSubmitObserver associated with the
// element / window this notification is about. // element / window this notification is about.
let element = aInvalidElements.queryElementAt(0, Ci.nsISupports); let element = aInvalidElements.queryElementAt(0, Ci.nsISupports);
if (this._content != element.ownerDocument.defaultView.top.document.defaultView) { if (this._content != element.ownerGlobal.top.document.defaultView) {
return; return;
} }
@ -201,7 +201,7 @@ FormSubmitObserver.prototype =
(aElement.type == 'radio' || aElement.type == 'checkbox')) { (aElement.type == 'radio' || aElement.type == 'checkbox')) {
panelData.position = "bottomcenter topleft"; panelData.position = "bottomcenter topleft";
} else { } else {
let win = aElement.ownerDocument.defaultView; let win = aElement.ownerGlobal;
let style = win.getComputedStyle(aElement, null); let style = win.getComputedStyle(aElement, null);
if (style.direction == 'rtl') { if (style.direction == 'rtl') {
offset = parseInt(style.paddingRight) + parseInt(style.borderRightWidth); offset = parseInt(style.paddingRight) + parseInt(style.borderRightWidth);

View File

@ -48,7 +48,7 @@ var FormValidationHandler =
*/ */
receiveMessage: function (aMessage) { receiveMessage: function (aMessage) {
let window = aMessage.target.ownerDocument.defaultView; let window = aMessage.target.ownerGlobal;
let json = aMessage.json; let json = aMessage.json;
let tabBrowser = window.gBrowser; let tabBrowser = window.gBrowser;
switch (aMessage.name) { switch (aMessage.name) {

View File

@ -74,12 +74,12 @@ var BrowserHelper = {
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL); _priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
// If the tab is in the focused window, leave priority as it is // If the tab is in the focused window, leave priority as it is
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow) if (aBrowser.ownerGlobal != _lastFocusedWindow)
this.decreasePriority(aBrowser); this.decreasePriority(aBrowser);
}, },
onSelect: function NP_BH_onSelect(aBrowser) { onSelect: function NP_BH_onSelect(aBrowser) {
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView); let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
if (windowEntry.lastSelectedBrowser) if (windowEntry.lastSelectedBrowser)
this.decreasePriority(windowEntry.lastSelectedBrowser); this.decreasePriority(windowEntry.lastSelectedBrowser);
this.increasePriority(aBrowser); this.increasePriority(aBrowser);

View File

@ -247,7 +247,7 @@ PluginContent.prototype = {
return false; return false;
} }
let contentWindow = plugin.ownerDocument.defaultView; let contentWindow = plugin.ownerGlobal;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils); .getInterface(Ci.nsIDOMWindowUtils);
@ -526,7 +526,7 @@ PluginContent.prototype = {
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType); let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
let principal = objLoadingContent.ownerDocument.defaultView.top.document.nodePrincipal; let principal = objLoadingContent.ownerGlobal.top.document.nodePrincipal;
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString); let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
let isFallbackTypeValid = let isFallbackTypeValid =
@ -612,7 +612,7 @@ PluginContent.prototype = {
onOverlayClick: function (event) { onOverlayClick: function (event) {
let document = event.target.ownerDocument; let document = event.target.ownerDocument;
let plugin = document.getBindingParent(event.target); let plugin = document.getBindingParent(event.target);
let contentWindow = plugin.ownerDocument.defaultView.top; let contentWindow = plugin.ownerGlobal.top;
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let overlay = this.getPluginUI(plugin, "main"); let overlay = this.getPluginUI(plugin, "main");
// Have to check that the target is not the link to update the plugin // Have to check that the target is not the link to update the plugin

View File

@ -347,7 +347,7 @@ var ProcessHangMonitor = {
}, },
handleEvent: function(event) { handleEvent: function(event) {
let win = event.target.ownerDocument.defaultView; let win = event.target.ownerGlobal;
// If a new tab is selected or if a tab changes remoteness, then // If a new tab is selected or if a tab changes remoteness, then
// we may need to show or hide a hang notification. // we may need to show or hide a hang notification.

View File

@ -81,7 +81,7 @@ var ReaderParent = {
}, },
updateReaderButton: function(browser) { updateReaderButton: function(browser) {
let win = browser.ownerDocument.defaultView; let win = browser.ownerGlobal;
if (browser != win.gBrowser.selectedBrowser) { if (browser != win.gBrowser.selectedBrowser) {
return; return;
} }
@ -134,7 +134,7 @@ var ReaderParent = {
}, },
toggleReaderMode: function(event) { toggleReaderMode: function(event) {
let win = event.target.ownerDocument.defaultView; let win = event.target.ownerGlobal;
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
browser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode"); browser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode");
}, },
@ -145,7 +145,7 @@ var ReaderParent = {
* @param browser The <browser> that the tour should be started for. * @param browser The <browser> that the tour should be started for.
*/ */
showReaderModeInfoPanel(browser) { showReaderModeInfoPanel(browser) {
let win = browser.ownerDocument.defaultView; let win = browser.ownerGlobal;
let targetPromise = UITour.getTarget(win, "readerMode-urlBar"); let targetPromise = UITour.getTarget(win, "readerMode-urlBar");
targetPromise.then(target => { targetPromise.then(target => {
let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");

View File

@ -35,7 +35,7 @@ var RemotePrompt = {
}, },
openTabPrompt: function(args, browser) { openTabPrompt: function(args, browser) {
let window = browser.ownerDocument.defaultView; let window = browser.ownerGlobal;
let tabPrompt = window.gBrowser.getTabModalPromptBox(browser) let tabPrompt = window.gBrowser.getTabModalPromptBox(browser)
let callbackInvoked = false; let callbackInvoked = false;
let newPrompt; let newPrompt;
@ -94,7 +94,7 @@ var RemotePrompt = {
}, },
openModalWindow: function(args, browser) { openModalWindow: function(args, browser) {
let window = browser.ownerDocument.defaultView; let window = browser.ownerGlobal;
try { try {
PromptUtils.fireDialogEvent(window, "DOMWillOpenModalDialog", browser); PromptUtils.fireDialogEvent(window, "DOMWillOpenModalDialog", browser);
let bag = PromptUtils.objectToPropBag(args); let bag = PromptUtils.objectToPropBag(args);

View File

@ -114,7 +114,7 @@ this.webrtcUI = {
let types = {camera: state.camera, microphone: state.microphone, let types = {camera: state.camera, microphone: state.microphone,
screen: state.screen}; screen: state.screen};
let browser = aStream.browser; let browser = aStream.browser;
let browserWindow = browser.ownerDocument.defaultView; let browserWindow = browser.ownerGlobal;
let tab = browserWindow.gBrowser && let tab = browserWindow.gBrowser &&
browserWindow.gBrowser.getTabForBrowser(browser); browserWindow.gBrowser.getTabForBrowser(browser);
return {uri: state.documentURI, tab: tab, browser: browser, types: types}; return {uri: state.documentURI, tab: tab, browser: browser, types: types};
@ -129,7 +129,7 @@ this.webrtcUI = {
}, },
showSharingDoorhanger: function(aActiveStream, aType) { showSharingDoorhanger: function(aActiveStream, aType) {
let browserWindow = aActiveStream.browser.ownerDocument.defaultView; let browserWindow = aActiveStream.browser.ownerGlobal;
if (aActiveStream.tab) { if (aActiveStream.tab) {
browserWindow.gBrowser.selectedTab = aActiveStream.tab; browserWindow.gBrowser.selectedTab = aActiveStream.tab;
} else { } else {
@ -593,7 +593,7 @@ function prompt(aBrowser, aRequest) {
} }
function removePrompt(aBrowser, aCallId) { function removePrompt(aBrowser, aCallId) {
let chromeWin = aBrowser.ownerDocument.defaultView; let chromeWin = aBrowser.ownerGlobal;
let notification = let notification =
chromeWin.PopupNotifications.getNotification("webRTC-shareDevices", aBrowser); chromeWin.PopupNotifications.getNotification("webRTC-shareDevices", aBrowser);
if (notification && notification.callID == aCallId) if (notification && notification.callID == aCallId)
@ -875,7 +875,7 @@ function updateIndicators(data, target) {
} }
function updateBrowserSpecificIndicator(aBrowser, aState) { function updateBrowserSpecificIndicator(aBrowser, aState) {
let chromeWin = aBrowser.ownerDocument.defaultView; let chromeWin = aBrowser.ownerGlobal;
let tabbrowser = chromeWin.gBrowser; let tabbrowser = chromeWin.gBrowser;
if (tabbrowser) { if (tabbrowser) {
let sharing; let sharing;
@ -1009,7 +1009,7 @@ function updateBrowserSpecificIndicator(aBrowser, aState) {
} }
function removeBrowserNotification(aBrowser, aNotificationId) { function removeBrowserNotification(aBrowser, aNotificationId) {
let win = aBrowser.ownerDocument.defaultView; let win = aBrowser.ownerGlobal;
let notification = let notification =
win.PopupNotifications.getNotification(aNotificationId, aBrowser); win.PopupNotifications.getNotification(aNotificationId, aBrowser);
if (notification) if (notification)