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) {
browser = event.originalTarget;
} else {
let topWin = event.target.ownerDocument.defaultView.top;
let topWin = event.target.ownerGlobal.top;
browser = gBrowser.getBrowserForContentWindow(topWin);
}
TelemetryStopwatch.start("FULLSCREEN_CHANGE_MS");

View File

@ -1166,7 +1166,7 @@ var PlacesToolbarHelper = {
onWidgetUnderflow: function(aNode, aContainer) {
// The view gets broken by being removed and reinserted by the overflowable
// 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) {
this._resetView();
}
@ -1909,7 +1909,7 @@ var BookmarkingUI = {
gNavigatorBundle.getString("starButtonOverflowedStarred.label");
},
onWidgetOverflow: function(aNode, aContainer) {
let win = aNode.ownerDocument.defaultView;
let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return;
@ -1925,7 +1925,7 @@ var BookmarkingUI = {
},
onWidgetUnderflow: function(aNode, aContainer) {
let win = aNode.ownerDocument.defaultView;
let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return;

View File

@ -183,7 +183,7 @@ SocialUI = {
return;
// 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)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)

View File

@ -4410,7 +4410,7 @@ var XULBrowserWindow = {
pageTooltip.hidePopup();
}
else {
for (let tooltipWindow = tooltipNode.ownerDocument.defaultView;
for (let tooltipWindow = tooltipNode.ownerGlobal;
tooltipWindow != tooltipWindow.parent;
tooltipWindow = tooltipWindow.parent) {
if (tooltipWindow == aWebProgress.DOMWindow) {
@ -6041,7 +6041,7 @@ var IndexedDBPromptHelper = {
var requestor = subject.QueryInterface(Ci.nsIInterfaceRequestor);
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.
return;
}

View File

@ -204,7 +204,7 @@ var showContentContextMenu = function (event) {
// commands on the context menu.
docShell.contentViewer.QueryInterface(Ci.nsIContentViewerEdit)
.setCommandNode(event.target);
event.target.ownerDocument.defaultView.updateCommands("contentcontextmenu");
event.target.ownerGlobal.updateCommands("contentcontextmenu");
let customMenuItems = PageMenuChild.build(event.target);
let principal = doc.nodePrincipal;
@ -219,7 +219,7 @@ var showContentContextMenu = function (event) {
else {
// Break out to the parent window and pass the add-on info along
let browser = docShell.chromeEventHandler;
let mainWin = browser.ownerDocument.defaultView;
let mainWin = browser.ownerGlobal;
mainWin.gContextMenuContentData = {
isRemote: false,
event: event,
@ -915,7 +915,7 @@ var LightWeightThemeWebInstallListener = {
baseURI: event.target.baseURI,
themeData: event.target.getAttribute("data-browsertheme"),
});
this._previewWindow = event.target.ownerDocument.defaultView;
this._previewWindow = event.target.ownerGlobal;
this._previewWindow.addEventListener("pagehide", this, true);
break;
}
@ -1170,7 +1170,7 @@ var PageInfoListener = {
getMediaItems: function(document, strings, elem)
{
// 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,
// multiple background images.
let mediaItems = [];

View File

@ -587,7 +587,7 @@ nsContextMenu.prototype = {
inspectNode: function() {
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);
return gDevTools.showToolbox(target, "inspector").then(toolbox => {

View File

@ -25,7 +25,7 @@ add_task(function* () {
let div = content.document.getElementById("badCertAdvancedPanel");
// Confirm that the expert section is collapsed
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");
});
@ -41,7 +41,7 @@ add_task(function* () {
yield remote(() => {
let div = content.document.getElementById("badCertAdvancedPanel");
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");
});

View File

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

View File

@ -25,7 +25,7 @@ registerCleanupFunction(function() {
});
function hidden(el) {
let win = el.ownerDocument.defaultView;
let win = el.ownerGlobal;
let display = win.getComputedStyle(el).getPropertyValue("display", 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");
yield promiseTabLoadEvent(tab, TRACKING_PAGE);
testTrackingPage(tab.ownerDocument.defaultView);
testTrackingPage(tab.ownerGlobal);
info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);
@ -117,7 +117,7 @@ add_task(function* testExceptionPersistence() {
info("Load a test page containing tracking elements");
yield promiseTabLoadEvent(tab, TRACKING_PAGE);
testTrackingPage(tab.ownerDocument.defaultView);
testTrackingPage(tab.ownerGlobal);
info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);

View File

@ -13,7 +13,7 @@ function openContextMenuFor(element, shiftkey, waitForSpellCheck) {
function actuallyOpenContextMenuFor() {
lastElement = element;
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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@ this.EXPORTED_SYMBOLS = ["DragPositionManager"];
function AreaPositionManager(aContainer) {
// 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;
let containerRect = aContainer.getBoundingClientRect();
this._containerInfo = {
@ -34,7 +34,7 @@ AreaPositionManager.prototype = {
_wideCache: null,
update: function(aContainer) {
let window = aContainer.ownerDocument.defaultView;
let window = aContainer.ownerGlobal;
this._nodePositionStore = new WeakMap();
this._wideCache = new Set();
let last = null;

View File

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

View File

@ -114,7 +114,7 @@ BrowserAction.prototype = {
});
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;
},
@ -196,7 +196,7 @@ BrowserAction.prototype = {
updateOnChange(tab) {
if (tab) {
if (tab.selected) {
this.updateWindow(tab.ownerDocument.defaultView);
this.updateWindow(tab.ownerGlobal);
}
} else {
for (let window of WindowListManager.browserWindows()) {

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ function getSender(context, target, sender) {
// We can just get the |tab| from |target|.
if (target instanceof Ci.nsIDOMXULElement) {
// The message came from a content script.
let tabbrowser = target.ownerDocument.defaultView.gBrowser;
let tabbrowser = target.ownerGlobal.gBrowser;
if (!tabbrowser) {
return;
}
@ -54,7 +54,7 @@ extensions.on("page-load", (type, page, params, sender, delegate) => {
if (params.type == "tab" || params.type == "popup") {
let browser = params.docShell.chromeEventHandler;
let parentWindow = browser.ownerDocument.defaultView;
let parentWindow = browser.ownerGlobal;
page.windowId = WindowManager.getId(parentWindow);
let tab = parentWindow.gBrowser.getTabForBrowser(browser);
@ -206,14 +206,14 @@ let tabListener = {
},
emitAttached(tab) {
let newWindowId = WindowManager.getId(tab.ownerDocument.defaultView);
let newWindowId = WindowManager.getId(tab.ownerGlobal);
let tabId = TabManager.getId(tab);
this.emit("tab-attached", {tab, tabId, newWindowId, newPosition: tab._tPos});
},
emitDetached(tab, adoptedBy) {
let oldWindowId = WindowManager.getId(tab.ownerDocument.defaultView);
let oldWindowId = WindowManager.getId(tab.ownerGlobal);
let tabId = TabManager.getId(tab);
this.emit("tab-detached", {tab, adoptedBy, tabId, oldWindowId, oldPosition: tab._tPos});
@ -224,7 +224,7 @@ let tabListener = {
},
emitRemoved(tab, isWindowClosing) {
let windowId = WindowManager.getId(tab.ownerDocument.defaultView);
let windowId = WindowManager.getId(tab.ownerGlobal);
let tabId = TabManager.getId(tab);
this.emit("tab-removed", {tab, tabId, windowId, isWindowClosing});
@ -243,7 +243,7 @@ let tabListener = {
onLocationChange(browser, webProgress, request, locationURI, flags) {
if (webProgress.isTopLevel) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser;
let gBrowser = browser.ownerGlobal.gBrowser;
let tab = gBrowser.getTabForBrowser(browser);
let deferred = this.tabReadyPromises.get(tab);
@ -267,7 +267,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
onActivated: new WindowEventManager(context, "tabs.onActivated", "TabSelect", (fire, event) => {
let tab = event.originalTarget;
let tabId = TabManager.getId(tab);
let windowId = WindowManager.getId(tab.ownerDocument.defaultView);
let windowId = WindowManager.getId(tab.ownerGlobal);
fire({tabId, windowId});
}).api(),
@ -292,7 +292,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
onHighlighted: new WindowEventManager(context, "tabs.onHighlighted", "TabSelect", (fire, event) => {
let tab = event.originalTarget;
let tabIds = [TabManager.getId(tab)];
let windowId = WindowManager.getId(tab.ownerDocument.defaultView);
let windowId = WindowManager.getId(tab.ownerGlobal);
fire({tabIds, windowId});
}).api(),
@ -363,7 +363,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
}
fire(TabManager.getId(tab), {
windowId: WindowManager.getId(tab.ownerDocument.defaultView),
windowId: WindowManager.getId(tab.ownerGlobal),
fromIndex: event.detail,
toIndex: tab._tPos,
});
@ -393,7 +393,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
let fireForBrowser = (browser, changed) => {
let [needed, changeInfo] = sanitize(extension, changed);
if (needed) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser;
let gBrowser = browser.ownerGlobal.gBrowser;
let tabElem = gBrowser.getTabForBrowser(browser);
let tab = TabManager.convert(extension, tabElem);
@ -550,7 +550,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
for (let tabId of tabs) {
let tab = TabManager.getTab(tabId);
tab.ownerDocument.defaultView.gBrowser.removeTab(tab);
tab.ownerGlobal.gBrowser.removeTab(tab);
}
return Promise.resolve();
@ -563,7 +563,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
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) {
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.
let window = destinationWindow || tab.ownerDocument.defaultView;
let window = destinationWindow || tab.ownerGlobal;
let gBrowser = window.gBrowser;
let insertionPoint = indexMap.get(window) || index;
@ -902,7 +902,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
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
// to the new window.
tab = gBrowser.adoptTab(tab, insertionPoint, false);
@ -922,7 +922,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
return Promise.reject({message: `Invalid tab ID: ${tabId}`});
}
let gBrowser = tab.ownerDocument.defaultView.gBrowser;
let gBrowser = tab.ownerGlobal.gBrowser;
let newTab = gBrowser.duplicateTab(tab);
return new Promise(resolve => {
@ -952,7 +952,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
getZoom(tabId) {
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
let {ZoomManager} = tab.ownerDocument.defaultView;
let {ZoomManager} = tab.ownerGlobal;
let zoom = ZoomManager.getZoomForBrowser(tab.linkedBrowser);
return Promise.resolve(zoom);
@ -961,7 +961,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
setZoom(tabId, zoom) {
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
let {FullZoom, ZoomManager} = tab.ownerDocument.defaultView;
let {FullZoom, ZoomManager} = tab.ownerGlobal;
if (zoom === 0) {
// A value of zero means use the default zoom factor.
@ -980,7 +980,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
_getZoomSettings(tabId) {
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
let {FullZoom} = tab.ownerDocument.defaultView;
let {FullZoom} = tab.ownerGlobal;
return {
mode: "automatic",
@ -1006,7 +1006,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
onZoomChange: new EventManager(context, "tabs.onZoomChange", fire => {
let getZoomLevel = browser => {
let {ZoomManager} = browser.ownerDocument.defaultView;
let {ZoomManager} = browser.ownerGlobal;
return ZoomManager.getZoomForBrowser(browser);
};
@ -1040,7 +1040,7 @@ extensions.registerSchemaAPI("tabs", (extension, context) => {
.chromeEventHandler;
}
let {gBrowser} = browser.ownerDocument.defaultView;
let {gBrowser} = browser.ownerGlobal;
let tab = gBrowser.getTabForBrowser(browser);
if (!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.viewNode = viewNode;
this.browserStyle = browserStyle;
this.window = viewNode.ownerDocument.defaultView;
this.window = viewNode.ownerGlobal;
this.contentReady = new Promise(resolve => {
this._resolveContentReady = resolve;
@ -328,7 +328,7 @@ TabContext.prototype = {
},
onLocationChange(browser, webProgress, request, locationURI, flags) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser;
let gBrowser = browser.ownerGlobal.gBrowser;
if (browser === gBrowser.selectedBrowser) {
let tab = gBrowser.getTabForBrowser(browser);
this.emit("location-change", tab, true);
@ -384,7 +384,7 @@ ExtensionTabManager.prototype = {
},
convert(tab) {
let window = tab.ownerDocument.defaultView;
let window = tab.ownerGlobal;
let browser = tab.linkedBrowser;
let mutedInfo = {muted: tab.muted};
@ -495,7 +495,7 @@ global.TabManager = {
},
getBrowserId(browser) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser;
let gBrowser = browser.ownerGlobal.gBrowser;
// Some non-browser windows have gBrowser but not
// getTabForBrowser!
if (gBrowser && gBrowser.getTabForBrowser) {

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ var gTabsListener = {
}
var tab = aEvent.target;
is(tab.ownerDocument.defaultView, window,
is(tab.ownerGlobal, window,
"Tab has been opened in current browser window");
},
@ -62,7 +62,7 @@ var gTabsListener = {
gBrowser.removeCurrentTab();
// 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;
// Simulate the click.
EventUtils.synthesizeMouse(aTree.body, x, y, aOptions || {},
aTree.ownerDocument.defaultView);
aTree.ownerGlobal);
}
/**

View File

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

View File

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

View File

@ -32,10 +32,10 @@ add_task(function* testNormalBrowsing() {
info("Load a test page that's whitelisted");
Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, "example.com,www.ItIsaTrap.org,example.net");
yield promiseTabLoadEvent(tab, TEST_PAGE, "load");
testWhitelistedPage(tab.ownerDocument.defaultView);
testWhitelistedPage(tab.ownerGlobal);
info("Load a test page that's no longer whitelisted");
Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, "");
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;
function* synthesizeNativeMouseMove(aElement) {
let rect = aElement.getBoundingClientRect();
let win = aElement.ownerDocument.defaultView;
let win = aElement.ownerGlobal;
let x = win.mozInnerScreenX + (rect.left + rect.right) / 2;
let y = win.mozInnerScreenY + (rect.top + rect.bottom) / 2;

View File

@ -24,7 +24,7 @@ const scale = utils.screenPixelsPerCSSPixel;
function* synthesizeNativeMouseClick(aElement) {
let rect = aElement.getBoundingClientRect();
let win = aElement.ownerDocument.defaultView;
let win = aElement.ownerGlobal;
let x = win.mozInnerScreenX + (rect.left + rect.right) / 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
// manager message, so the target will be a <xul:browser>.
var browser = aMessage.target;
let win = browser.ownerDocument.defaultView;
let win = browser.ownerGlobal;
let tab = win ? win.gBrowser.getTabForBrowser(browser) : null;
// 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
*/
handleEvent: function ssi_handleEvent(aEvent) {
let win = aEvent.currentTarget.ownerDocument.defaultView;
let win = aEvent.currentTarget.ownerGlobal;
let target = aEvent.originalTarget;
switch (aEvent.type) {
case "TabOpen":
@ -2051,7 +2051,7 @@ var SessionStoreInternal = {
},
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);
}
@ -2076,7 +2076,7 @@ var SessionStoreInternal = {
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)) {
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) {
if (!aTab.ownerDocument.defaultView.__SSi) {
if (!aTab.ownerGlobal.__SSi) {
throw Components.Exception("Default view is not tracked", Cr.NS_ERROR_INVALID_ARG);
}
if (!aWindow.gBrowser) {
@ -2118,7 +2118,7 @@ var SessionStoreInternal = {
return;
}
let window = newTab.ownerDocument && newTab.ownerDocument.defaultView;
let window = newTab.ownerGlobal;
// The tab or its window might be gone.
if (!window || !window.__SSi) {
@ -2305,13 +2305,13 @@ var SessionStoreInternal = {
}
aTab.__SS_extdata[aKey] = aStringValue;
this.saveStateDelayed(aTab.ownerDocument.defaultView);
this.saveStateDelayed(aTab.ownerGlobal);
},
deleteTabValue: function ssi_deleteTabValue(aTab, aKey) {
if (aTab.__SS_extdata && aKey in aTab.__SS_extdata) {
delete aTab.__SS_extdata[aKey];
this.saveStateDelayed(aTab.ownerDocument.defaultView);
this.saveStateDelayed(aTab.ownerGlobal);
}
},
@ -2509,7 +2509,7 @@ var SessionStoreInternal = {
* flush has finished.
*/
navigateAndRestore(tab, loadArguments, historyIndex) {
let window = tab.ownerDocument.defaultView;
let window = tab.ownerGlobal;
NS_ASSERT(window.__SSi, "tab's window must be tracked");
let browser = tab.linkedBrowser;
@ -2547,7 +2547,7 @@ var SessionStoreInternal = {
return;
}
let window = tab.ownerDocument && tab.ownerDocument.defaultView;
let window = tab.ownerGlobal;
// The tab or its window might be gone.
if (!window || !window.__SSi || window.closed) {
@ -3210,7 +3210,7 @@ var SessionStoreInternal = {
let restoreImmediately = options.restoreImmediately;
let loadArguments = options.loadArguments;
let browser = tab.linkedBrowser;
let window = tab.ownerDocument.defaultView;
let window = tab.ownerGlobal;
let tabbrowser = window.gBrowser;
let forceOnDemand = options.forceOnDemand;
@ -3350,7 +3350,7 @@ var SessionStoreInternal = {
}
let browser = aTab.linkedBrowser;
let window = aTab.ownerDocument.defaultView;
let window = aTab.ownerGlobal;
let tabbrowser = window.gBrowser;
let tabData = TabState.clone(aTab);
let activeIndex = tabData.index - 1;
@ -4145,7 +4145,7 @@ var SessionStoreInternal = {
NS_ASSERT(aTab.linkedBrowser.__SS_restoreState,
"given tab is not restoring");
let window = aTab.ownerDocument.defaultView;
let window = aTab.ownerGlobal;
let browser = aTab.linkedBrowser;
// Keep the tab's previous state for later in this method

View File

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

View File

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

View File

@ -18,7 +18,7 @@ add_task(function* () {
aTextField.value = aValue;
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);
}

View File

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

View File

@ -38,7 +38,7 @@ function queryElement(data) {
function dispatchUIEvent(input, type) {
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);
}

View File

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

View File

@ -364,7 +364,7 @@ this.UITour = {
onPageEvent: function(aMessage, aEvent) {
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
// not have tabs.
@ -721,7 +721,7 @@ this.UITour = {
// 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 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) {
tabBrowser.removeTab(tabBrowser.getTabForBrowser(browser));
}
@ -755,7 +755,7 @@ this.UITour = {
log.debug("handleEvent: type =", aEvent.type, "event =", aEvent);
switch (aEvent.type) {
case "TabSelect": {
let window = aEvent.target.ownerDocument.defaultView;
let window = aEvent.target.ownerGlobal;
// Teardown the browser of the tab we just switched away from.
if (aEvent.detail && aEvent.detail.previousTab) {
@ -972,7 +972,7 @@ this.UITour = {
},
isElementVisible: function(aElement) {
let targetStyle = aElement.ownerDocument.defaultView.getComputedStyle(aElement);
let targetStyle = aElement.ownerGlobal.getComputedStyle(aElement);
return !aElement.ownerDocument.hidden &&
targetStyle.display != "none" &&
targetStyle.visibility == "visible";
@ -1825,7 +1825,7 @@ this.UITour = {
},
hideAnnotationsForPanel: function(aEvent, aTargetPositionCallback) {
let win = aEvent.target.ownerDocument.defaultView;
let win = aEvent.target.ownerGlobal;
let annotationElements = new Map([
// [annotationElement (panel), method to hide the annotation]
[win.document.getElementById("UITourHighlightContainer"), UITour.hideHighlight.bind(UITour)],
@ -2063,7 +2063,7 @@ this.UITour = {
if (observer) {
return;
}
let win = aPanelEl.ownerDocument.defaultView;
let win = aPanelEl.ownerGlobal;
observer = new win.MutationObserver(this._annotationMutationCallback);
this._annotationPanelMutationObservers.set(aPanelEl, observer);
let observerOptions = {

View File

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

View File

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

View File

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

View File

@ -165,7 +165,7 @@ this.CaptivePortalWatcher = {
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,
// leave it open if the tab has focus.

View File

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

View File

@ -32,7 +32,7 @@ var ContentClick = {
contentAreaClick: function (json, browser) {
// This is heavily based on contentAreaClick from browser.js (Bug 903016)
// 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) {
// Might be middle mouse navigation.

View File

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

View File

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

View File

@ -230,17 +230,12 @@ this.ContentSearch = {
let engine = Services.search.getEngineByName(data.engineName);
let submission = engine.getSubmission(data.searchString, "", data.searchPurpose);
let browser = msg.target;
let win;
try {
win = browser.ownerDocument.defaultView;
}
catch (err) {
let win = browser.ownerGlobal;
if (!win) {
// 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
// method on it will throw.
// message and the time we handle it.
return;
}
let where = win.whereToOpenLink(data.originalEvent);
// 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) {
let browserWin = msg.target.ownerDocument.defaultView;
let browserWin = msg.target.ownerGlobal;
browserWin.openPreferences("paneSearch");
},

View File

@ -107,7 +107,7 @@ FormSubmitObserver.prototype =
// Insure that this is the FormSubmitObserver associated with the
// element / window this notification is about.
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;
}
@ -201,7 +201,7 @@ FormSubmitObserver.prototype =
(aElement.type == 'radio' || aElement.type == 'checkbox')) {
panelData.position = "bottomcenter topleft";
} else {
let win = aElement.ownerDocument.defaultView;
let win = aElement.ownerGlobal;
let style = win.getComputedStyle(aElement, null);
if (style.direction == 'rtl') {
offset = parseInt(style.paddingRight) + parseInt(style.borderRightWidth);

View File

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

View File

@ -74,12 +74,12 @@ var BrowserHelper = {
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
// 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);
},
onSelect: function NP_BH_onSelect(aBrowser) {
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
if (windowEntry.lastSelectedBrowser)
this.decreasePriority(windowEntry.lastSelectedBrowser);
this.increasePriority(aBrowser);

View File

@ -247,7 +247,7 @@ PluginContent.prototype = {
return false;
}
let contentWindow = plugin.ownerDocument.defaultView;
let contentWindow = plugin.ownerGlobal;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
@ -526,7 +526,7 @@ PluginContent.prototype = {
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
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 isFallbackTypeValid =
@ -612,7 +612,7 @@ PluginContent.prototype = {
onOverlayClick: function (event) {
let document = event.target.ownerDocument;
let plugin = document.getBindingParent(event.target);
let contentWindow = plugin.ownerDocument.defaultView.top;
let contentWindow = plugin.ownerGlobal.top;
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let overlay = this.getPluginUI(plugin, "main");
// 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) {
let win = event.target.ownerDocument.defaultView;
let win = event.target.ownerGlobal;
// If a new tab is selected or if a tab changes remoteness, then
// we may need to show or hide a hang notification.

View File

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

View File

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

View File

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