Bug 1334156 - script-generated patch to replace .ownerDocument.defaultView with .ownerGlobal, r=jaws.

This commit is contained in:
Florian Quèze 2017-01-27 10:51:03 +01:00
Родитель 0cb03c69e1
Коммит b11907c7aa
123 изменённых файлов: 232 добавлений и 238 удалений

Просмотреть файл

@ -116,7 +116,7 @@ this.EventManager.prototype = {
else if (aEvent.target instanceof Ci.nsIDOMDocument)
window = aEvent.target.defaultView;
else if (aEvent.target instanceof Ci.nsIDOMElement)
window = aEvent.target.ownerDocument.defaultView;
window = aEvent.target.ownerGlobal;
this.present(Presentation.viewportChanged(window));
break;
}

Просмотреть файл

@ -112,7 +112,7 @@ function waveOverImageMap(aImageMapID)
{
var imageMapNode = getNode(aImageMapID);
synthesizeMouse(imageMapNode, 10, 10, { type: "mousemove" },
imageMapNode.ownerDocument.defaultView);
imageMapNode.ownerGlobal);
}
/**
@ -1597,7 +1597,7 @@ function moveCaretToDOMPoint(aID, aDOMPointNodeID, aDOMPointOffset,
if (this.focusNode)
this.focusNode.focus();
var selection = this.DOMPointNode.ownerDocument.defaultView.getSelection();
var selection = this.DOMPointNode.ownerGlobal.getSelection();
var selRange = selection.getRangeAt(0);
selRange.setStart(this.DOMPointNode, aDOMPointOffset);
selRange.collapse(true);

Просмотреть файл

@ -161,7 +161,7 @@
{
this.id = aIDFunc.call(null, aIDFuncArg);
this.node = getNode(this.id);
this.window = this.node.ownerDocument.defaultView;
this.window = this.node.ownerGlobal;
if (this.node.localName == "tree") {
var tree = getAccessible(this.node);
@ -219,7 +219,7 @@
{
var id = aIDFunc.call(null, aIDFuncArg);
var node = getNode(id);
var targetWindow = node.ownerDocument.defaultView;
var targetWindow = node.ownerGlobal;
var x = 0, y = 0;
if (node.localName == "tree") {

Просмотреть файл

@ -235,7 +235,7 @@ function getBoundsForDOMElm(aID)
height = rect.height;
}
var elmWindow = elm.ownerDocument.defaultView;
var elmWindow = elm.ownerGlobal;
return CSSToDevicePixels(elmWindow,
x + elmWindow.mozInnerScreenX,
y + elmWindow.mozInnerScreenY,

Просмотреть файл

@ -62,11 +62,11 @@ const isVideoLoadingAudio = node =>
(node.videoWidth == 0 || node.videoHeight == 0)
const isVideo = node =>
node instanceof node.ownerDocument.defaultView.HTMLVideoElement &&
node instanceof node.ownerGlobal.HTMLVideoElement &&
!isVideoLoadingAudio(node);
const isAudio = node => {
const {HTMLVideoElement, HTMLAudioElement} = node.ownerDocument.defaultView;
const {HTMLVideoElement, HTMLAudioElement} = node.ownerGlobal;
return node instanceof HTMLAudioElement ? true :
node instanceof HTMLVideoElement ? isVideoLoadingAudio(node) :
false;
@ -165,12 +165,12 @@ const nonPageSelector = nonPageElements.
// but old implementation was also checked for collapsed selection there for to keep
// the behavior same we end up implementing a new reader.
parsers["reader/isPage()"] = constant(node =>
node.ownerDocument.defaultView.getSelection().isCollapsed &&
node.ownerGlobal.getSelection().isCollapsed &&
!node.matches(nonPageSelector));
// Reads `true` if node is in an iframe otherwise returns true.
parsers["reader/isFrame()"] = constant(node =>
!!node.ownerDocument.defaultView.frameElement);
!!node.ownerGlobal.frameElement);
parsers["reader/isEditable()"] = constant(node => {
const selection = getInputSelection(node);

Просмотреть файл

@ -21,5 +21,5 @@ const windowToMessageManager = window =>
exports.windowToMessageManager = windowToMessageManager;
const nodeToMessageManager = node =>
windowToMessageManager(node.ownerDocument.defaultView);
windowToMessageManager(node.ownerGlobal);
exports.nodeToMessageManager = nodeToMessageManager;

Просмотреть файл

@ -132,7 +132,7 @@ CONTEXTS.PageContext = Class({
getState: function(popupNode) {
// If there is a selection in the window then this context does not match
if (!popupNode.ownerDocument.defaultView.getSelection().isCollapsed)
if (!popupNode.ownerGlobal.getSelection().isCollapsed)
return false;
// If the clicked node or any of its ancestors is one of the blocked
@ -153,7 +153,7 @@ CONTEXTS.SelectionContext = Class({
extends: Context,
getState: function(popupNode) {
if (!popupNode.ownerDocument.defaultView.getSelection().isCollapsed)
if (!popupNode.ownerGlobal.getSelection().isCollapsed)
return true;
try {
@ -211,7 +211,7 @@ CONTEXTS.PredicateContext = Class({
extends: Context,
getState: function(node) {
let window = node.ownerDocument.defaultView;
let window = node.ownerGlobal;
let data = {};
data.documentType = node.ownerDocument.contentType;
@ -325,7 +325,7 @@ var RemoteItem = Class({
},
activate: function(popupNode, data) {
let worker = getItemWorkerForWindow(this, popupNode.ownerDocument.defaultView);
let worker = getItemWorkerForWindow(this, popupNode.ownerGlobal);
if (!worker)
return;
@ -344,7 +344,7 @@ var RemoteItem = Class({
};
}
let worker = getItemWorkerForWindow(this, popupNode.ownerDocument.defaultView);
let worker = getItemWorkerForWindow(this, popupNode.ownerGlobal);
let contextStates = {};
for (let context of this.contexts)
contextStates[context.id] = context.getState(popupNode);

Просмотреть файл

@ -996,7 +996,7 @@ var MenuWrapper = Class({
this.populate(this.items);
}
let mainWindow = event.target.ownerDocument.defaultView;
let mainWindow = event.target.ownerGlobal;
this.contextMenuContentData = mainWindow.gContextMenuContentData
if (!(self.id in this.contextMenuContentData.addonInfo)) {
console.warn("No context menu state data was provided.");

Просмотреть файл

@ -157,7 +157,7 @@ exports.emit = emit;
// when given element is removed from it's parent node.
const removed = element => {
return new Promise(resolve => {
const { MutationObserver } = element.ownerDocument.defaultView;
const { MutationObserver } = element.ownerGlobal;
const observer = new MutationObserver(mutations => {
for (let mutation of mutations) {
for (let node of mutation.removedNodes || []) {

Просмотреть файл

@ -21,7 +21,7 @@ const { ThreadSafeChromeUtils } = Cu.import("resource://gre/modules/Services.jsm
var getWindowFrom = x =>
x instanceof Ci.nsIDOMWindow ? x :
x instanceof Ci.nsIDOMDocument ? x.defaultView :
x instanceof Ci.nsIDOMNode ? x.ownerDocument.defaultView :
x instanceof Ci.nsIDOMNode ? x.ownerGlobal :
null;
function removeFromListeners() {

Просмотреть файл

@ -138,7 +138,7 @@ function display(panel, options, anchor) {
// The XUL Panel has an arrow, so the margin needs to be reset
// to the default value.
panel.style.margin = "";
let { CustomizableUI, window } = anchor.ownerDocument.defaultView;
let { CustomizableUI, window } = anchor.ownerGlobal;
// In Australis, widgets may be positioned in an overflow panel or the
// menu panel.

Просмотреть файл

@ -145,7 +145,7 @@ function getFocusedWindow() {
function getFocusedElement() {
let element = winUtils.getFocusedElement();
if (!element || ignoreWindow(element.ownerDocument.defaultView))
if (!element || ignoreWindow(element.ownerGlobal))
return null;
return element;

Просмотреть файл

@ -68,7 +68,7 @@ function makeEvents() {
exports.events = map(makeEvents(), function (event) {
return !isFennec ? event : {
type: event.type,
target: event.target.ownerDocument.defaultView.BrowserApp
target: event.target.ownerGlobal.BrowserApp
.getTabForBrowser(event.target)
};
});

Просмотреть файл

@ -67,7 +67,7 @@ const Tab = Class({
getURL.implement(this, tab => tab.url);
isPrivate.implement(this, tab => {
return isWindowPrivate(viewsFor.get(tab).ownerDocument.defaultView);
return isWindowPrivate(viewsFor.get(tab).ownerGlobal);
});
},
@ -123,7 +123,7 @@ const Tab = Class({
// TODO: Remove the dependency on the windows module, see bug 792670
require('../windows');
let tabElement = viewsFor.get(this);
let domWindow = tabElement.ownerDocument.defaultView;
let domWindow = tabElement.ownerGlobal;
return modelFor(domWindow);
},
@ -256,7 +256,7 @@ function tabEmit(tab, event, ...args) {
// If the windows module was never loaded this will return null. We don't need
// to emit to the window.tabs object in this case as nothing can be listening.
let tabElement = viewsFor.get(tab);
let window = maybeWindowFor(tabElement.ownerDocument.defaultView);
let window = maybeWindowFor(tabElement.ownerGlobal);
if (window)
emit(window.tabs, event, tab, ...args);
@ -281,7 +281,7 @@ when(_ => {
// Listen for tabbrowser events
function tabEventListener(event, tabElement, ...args) {
let domWindow = tabElement.ownerDocument.defaultView;
let domWindow = tabElement.ownerGlobal;
if (ignoreWindow(domWindow))
return;

Просмотреть файл

@ -106,7 +106,7 @@ exports.getActiveTab = getActiveTab;
function getOwnerWindow(tab) {
// normal case
if (tab.ownerDocument)
return tab.ownerDocument.defaultView;
return tab.ownerGlobal;
// try fennec case
return getWindowHoldingTab(tab);

Просмотреть файл

@ -51,7 +51,7 @@ const buttonListener = {
onWidgetAfterDOMChange: (node, nextNode, container) => {
let { id } = node;
let view = views.get(id);
let window = node.ownerDocument.defaultView;
let window = node.ownerGlobal;
if (view) {
emit(viewEvents, 'data', { type: 'update', target: id, window: window });

Просмотреть файл

@ -415,7 +415,7 @@ function getOwnerBrowserWindow(node) {
/**
Takes DOM node and returns browser window that contains it.
**/
let window = getToplevelWindow(node.ownerDocument.defaultView);
let window = getToplevelWindow(node.ownerGlobal);
// If anchored window is browser then it's target browser window.
return isBrowser(window) ? window : null;
}

Просмотреть файл

@ -40,7 +40,7 @@ function makeID(id) {
exports.makeID = makeID;
function simulateCommand(ele) {
let window = ele.ownerDocument.defaultView;
let window = ele.ownerGlobal;
let { document } = window;
var evt = document.createEvent('XULCommandEvent');
evt.initCommandEvent('command', true, true, window,
@ -50,7 +50,7 @@ function simulateCommand(ele) {
exports.simulateCommand = simulateCommand;
function simulateClick(ele) {
let window = ele.ownerDocument.defaultView;
let window = ele.ownerGlobal;
let { document } = window;
let evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window,

Просмотреть файл

@ -42,13 +42,13 @@ const openContextMenu = (selector, tab=getActiveTab()) => {
sendAsyncMessage("sdk/test/context-menu/open",
{target: selector});
return when(tab.ownerDocument.defaultView, "popupshown").
return when(tab.ownerGlobal, "popupshown").
then(_target);
};
exports.openContextMenu = openContextMenu;
const closeContextMenu = (menu) => {
const result = when(menu.ownerDocument.defaultView, "popuphidden").
const result = when(menu.ownerGlobal, "popuphidden").
then(_target);
menu.hidePopup();

Просмотреть файл

@ -47,7 +47,7 @@ function makeID(id) {
exports.makeID = makeID;
function simulateCommand(ele) {
let window = ele.ownerDocument.defaultView;
let window = ele.ownerGlobal;
let { document } = window;
var evt = document.createEvent('XULCommandEvent');
evt.initCommandEvent('command', true, true, window,
@ -57,7 +57,7 @@ function simulateCommand(ele) {
exports.simulateCommand = simulateCommand;
function simulateClick(ele) {
let window = ele.ownerDocument.defaultView;
let window = ele.ownerGlobal;
let { document } = window;
let evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window,

Просмотреть файл

@ -835,7 +835,7 @@ exports['test button icon set'] = function(assert) {
});
let { node, id: widgetId } = getWidget(button.id);
let { devicePixelRatio } = node.ownerDocument.defaultView;
let { devicePixelRatio } = node.ownerGlobal;
let size = 16 * devicePixelRatio;
@ -1125,7 +1125,7 @@ exports['test button badge property'] = function(assert) {
'badge color is not set');
let { node } = getWidget(button.id);
let { getComputedStyle } = node.ownerDocument.defaultView;
let { getComputedStyle } = node.ownerGlobal;
let badgeNode = badgeNodeFor(node);
assert.equal('1234', node.getAttribute('badge'),
@ -1168,7 +1168,7 @@ exports['test button badge color'] = function(assert) {
'badge color is set');
let { node } = getWidget(button.id);
let { getComputedStyle } = node.ownerDocument.defaultView;
let { getComputedStyle } = node.ownerGlobal;
let badgeNode = badgeNodeFor(node);
assert.equal(badgeNodeFor(node).style.backgroundColor, 'blue',

Просмотреть файл

@ -815,7 +815,7 @@ exports['test button icon set'] = function(assert) {
});
let { node, id: widgetId } = getWidget(button.id);
let { devicePixelRatio } = node.ownerDocument.defaultView;
let { devicePixelRatio } = node.ownerGlobal;
let size = 16 * devicePixelRatio;
@ -1104,7 +1104,7 @@ exports['test button badge property'] = function(assert) {
'badge color is not set');
let { node } = getWidget(button.id);
let { getComputedStyle } = node.ownerDocument.defaultView;
let { getComputedStyle } = node.ownerGlobal;
let badgeNode = badgeNodeFor(node);
assert.equal('1234', node.getAttribute('badge'),
@ -1147,7 +1147,7 @@ exports['test button badge color'] = function(assert) {
'badge color is set');
let { node } = getWidget(button.id);
let { getComputedStyle } = node.ownerDocument.defaultView;
let { getComputedStyle } = node.ownerGlobal;
let badgeNode = badgeNodeFor(node);
assert.equal(badgeNodeFor(node).style.backgroundColor, 'blue',

Просмотреть файл

@ -560,7 +560,7 @@ var shell = {
case 'mozbrowsercaretstatechanged':
{
let elt = evt.target;
let win = elt.ownerDocument.defaultView;
let win = elt.ownerGlobal;
let offsetX = win.mozInnerScreenX - window.mozInnerScreenX;
let offsetY = win.mozInnerScreenY - window.mozInnerScreenY;

Просмотреть файл

@ -297,10 +297,10 @@ ContentPermissionPrompt.prototype = {
// window.realFrameElement will be |null| if the code try to cross
// content -> chrome boundaries.
let targetElement = request.element;
let targetWindow = request.window || targetElement.ownerDocument.defaultView;
let targetWindow = request.window || targetElement.ownerGlobal;
while (targetWindow.realFrameElement) {
targetElement = targetWindow.realFrameElement;
targetWindow = targetElement.ownerDocument.defaultView;
targetWindow = targetElement.ownerGlobal;
}
SystemAppProxy.dispatchEvent(details, targetElement);

Просмотреть файл

@ -135,7 +135,7 @@ SSLExceptions.prototype = {
var ErrorPage = {
_addCertException: function(aMessage) {
let frameLoaderOwner = aMessage.target.QueryInterface(Ci.nsIFrameLoaderOwner);
let win = frameLoaderOwner.ownerDocument.defaultView;
let win = frameLoaderOwner.ownerGlobal;
let mm = frameLoaderOwner.frameLoader.messageManager;
let uri = Services.io.newURI(aMessage.data.url);

Просмотреть файл

@ -15,7 +15,7 @@ this.EXPORTED_SYMBOLS = ['Screenshot'];
var Screenshot = {
get: function screenshot_get() {
let systemAppFrame = SystemAppProxy.getFrame();
let window = systemAppFrame.ownerDocument.defaultView;
let window = systemAppFrame.ownerGlobal;
let document = window.document;
var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');

Просмотреть файл

@ -896,15 +896,13 @@ nsContextMenu.prototype = {
// Returns the computed style attribute for the given element.
getComputedStyle: function(aElem, aProp) {
return aElem.ownerDocument
.defaultView
return aElem.ownerGlobal
.getComputedStyle(aElem).getPropertyValue(aProp);
},
// Returns a "url"-type computed style attribute value, with the url() stripped.
getComputedURL: function(aElem, aProp) {
var url = aElem.ownerDocument
.defaultView.getComputedStyle(aElem)
var url = aElem.ownerGlobal.getComputedStyle(aElem)
.getPropertyCSSValue(aProp);
if (url instanceof CSSValueList) {
if (url.length != 1)

Просмотреть файл

@ -2836,7 +2836,7 @@
// Do not allow transfering a private tab to a non-private window
// and vice versa.
if (PrivateBrowsingUtils.isWindowPrivate(window) !=
PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerDocument.defaultView))
PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerGlobal))
return;
let ourBrowser = this.getBrowserForTab(aOurTab);
@ -2852,7 +2852,7 @@
}
// That's gBrowser for the other window, not the tab's browser!
var remoteBrowser = aOtherTab.ownerDocument.defaultView.gBrowser;
var remoteBrowser = aOtherTab.ownerGlobal.gBrowser;
var isPending = aOtherTab.hasAttribute("pending");
let otherTabListener = remoteBrowser._tabListeners.get(aOtherTab);
@ -3005,7 +3005,7 @@
// Unmap old outerWindowIDs.
this._outerWindowIDBrowserMap.delete(ourBrowser.outerWindowID);
let remoteBrowser = aOtherBrowser.ownerDocument.defaultView.gBrowser;
let remoteBrowser = aOtherBrowser.ownerGlobal.gBrowser;
if (remoteBrowser) {
remoteBrowser._outerWindowIDBrowserMap.delete(aOtherBrowser.outerWindowID);
}
@ -4120,7 +4120,7 @@
// our window. We save the state of otherBrowser since ourBrowser
// needs to take on that state at the end of the swap.
let otherTabbrowser = otherBrowser.ownerDocument.defaultView.gBrowser;
let otherTabbrowser = otherBrowser.ownerGlobal.gBrowser;
let otherState;
if (otherTabbrowser && otherTabbrowser._switcher) {
let otherTab = otherTabbrowser.getTabForBrowser(otherBrowser);
@ -6169,17 +6169,17 @@
let sourceNode = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
if (sourceNode instanceof XULElement &&
sourceNode.localName == "tab" &&
sourceNode.ownerDocument.defaultView instanceof ChromeWindow &&
sourceNode.ownerGlobal instanceof ChromeWindow &&
sourceNode.ownerDocument.documentElement.getAttribute("windowtype") == "navigator:browser" &&
sourceNode.ownerDocument.defaultView.gBrowser.tabContainer == sourceNode.parentNode) {
sourceNode.ownerGlobal.gBrowser.tabContainer == sourceNode.parentNode) {
// Do not allow transfering a private tab to a non-private window
// and vice versa.
if (PrivateBrowsingUtils.isWindowPrivate(window) !=
PrivateBrowsingUtils.isWindowPrivate(sourceNode.ownerDocument.defaultView))
PrivateBrowsingUtils.isWindowPrivate(sourceNode.ownerGlobal))
return "none";
if (window.gMultiProcessBrowser !=
sourceNode.ownerDocument.defaultView.gMultiProcessBrowser)
sourceNode.ownerGlobal.gMultiProcessBrowser)
return "none";
return dt.dropEffect == "copy" ? "copy" : "move";

Просмотреть файл

@ -1563,7 +1563,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
this.setAttribute("width", width);
// Adjust the direction of the autocomplete popup list based on the textbox direction, bug 649840
var popupDirection = aElement.ownerDocument.defaultView.getComputedStyle(aElement).direction;
var popupDirection = aElement.ownerGlobal.getComputedStyle(aElement).direction;
this.style.direction = popupDirection;
// Make the popup's starting margin negative so that the leading edge

Просмотреть файл

@ -23,7 +23,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);

Просмотреть файл

@ -43,7 +43,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);

Просмотреть файл

@ -263,7 +263,7 @@
let anchorRect = aAnchor.getBoundingClientRect();
let mainViewRect = this._mainViewContainer.getBoundingClientRect();
let center = aAnchor.clientWidth / 2;
let direction = aAnchor.ownerDocument.defaultView.getComputedStyle(aAnchor).direction;
let direction = aAnchor.ownerGlobal.getComputedStyle(aAnchor).direction;
let edge;
if (direction == "ltr") {
edge = anchorRect.left - mainViewRect.left;
@ -473,7 +473,7 @@
}
return height;
}
let win = aSubview.ownerDocument.defaultView;
let win = aSubview.ownerGlobal;
let body = aSubview.querySelector(".panel-subview-body");
let height = getFullHeight(body || aSubview);
if (body) {

Просмотреть файл

@ -186,7 +186,7 @@ BrowserAction.prototype = {
handleEvent(event) {
let button = event.target;
let window = button.ownerDocument.defaultView;
let window = button.ownerGlobal;
switch (event.type) {
case "mousedown":

Просмотреть файл

@ -126,10 +126,10 @@ 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 if (name == "_execute_browser_action") {
let win = event.target.ownerDocument.defaultView;
let win = event.target.ownerGlobal;
browserActionFor(this.extension).triggerAction(win);
} else {
TabManager.for(this.extension)

Просмотреть файл

@ -78,7 +78,7 @@ global.getTargetTabIdForToolbox = (toolbox) => {
throw new Error("Unexpected target type: only local tabs are currently supported.");
}
let parentWindow = target.tab.linkedBrowser.ownerDocument.defaultView;
let parentWindow = target.tab.linkedBrowser.ownerGlobal;
let tab = parentWindow.gBrowser.getTabForBrowser(target.tab.linkedBrowser);
return TabManager.getId(tab);

Просмотреть файл

@ -154,7 +154,7 @@ PageAction.prototype = {
},
handleEvent(event) {
const window = event.target.ownerDocument.defaultView;
const window = event.target.ownerGlobal;
switch (event.type) {
case "click":

Просмотреть файл

@ -69,7 +69,7 @@ let img = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAAB
var imageBuffer = Uint8Array.from(atob(img), byte => byte.charCodeAt(0)).buffer;
function getListStyleImage(button) {
let style = button.ownerDocument.defaultView.getComputedStyle(button);
let style = button.ownerGlobal.getComputedStyle(button);
let match = /^url\("(.*)"\)$/.exec(style.listStyleImage);

Просмотреть файл

@ -374,7 +374,7 @@ class OffscreenCanvas {
return this._canvas.getContext(contextId, contextOptions);
}
transferToImageBitmap() {
let window = this._canvas.ownerDocument.defaultView;
let window = this._canvas.ownerGlobal;
return window.createImageBitmap(this._canvas);
}
}

Просмотреть файл

@ -12,7 +12,7 @@
const { utils: Cu } = Components;
let mm = pluginElement.frameLoader.messageManager;
let containerWindow = pluginElement.ownerDocument.defaultView;
let containerWindow = pluginElement.ownerGlobal;
function mapValue(v, instance) {
return instance.rt.toPP_Var(v, instance);

Просмотреть файл

@ -19,7 +19,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
let mm = pluginElement.frameLoader.messageManager;
let containerWindow = pluginElement.ownerDocument.defaultView;
let containerWindow = pluginElement.ownerGlobal;
// Prevent the drag event's default action on the element, to avoid dragging of
// that element while the user selects text.
pluginElement.addEventListener("dragstart",

Просмотреть файл

@ -152,7 +152,7 @@ let URICountListener = {
// Don't count about:blank and similar pages, as they would artificially
// inflate the counts.
if (browser.ownerDocument.defaultView.gInitialPages.includes(uriSpec)) {
if (browser.ownerGlobal.gInitialPages.includes(uriSpec)) {
return;
}

Просмотреть файл

@ -20,7 +20,7 @@ var URLBarZoom = {
}
function updateZoomButton(aSubject, aTopic) {
let win = aSubject.ownerDocument.defaultView;
let win = aSubject.ownerGlobal;
let customizableZoomControls = win.document.getElementById("zoom-controls");
let zoomResetButton = win.document.getElementById("urlbar-zoom-button");
let zoomFactor = Math.round(win.ZoomManager.zoom * 100);

Просмотреть файл

@ -192,7 +192,7 @@ AutoRefreshHighlighter.prototype = {
},
_startRefreshLoop: function () {
let win = this.currentNode.ownerDocument.defaultView;
let win = this.currentNode.ownerGlobal;
this.rafID = win.requestAnimationFrame(this._startRefreshLoop.bind(this));
this.rafWin = win;
this.update();

Просмотреть файл

@ -295,7 +295,7 @@ BoxModelHighlighter.prototype = extend(AutoRefreshHighlighter.prototype, {
*/
_trackMutations: function () {
if (isNodeValid(this.currentNode)) {
let win = this.currentNode.ownerDocument.defaultView;
let win = this.currentNode.ownerGlobal;
this.currentNodeObserver = new win.MutationObserver(this.update);
this.currentNodeObserver.observe(this.currentNode, {attributes: true});
}

Просмотреть файл

@ -92,7 +92,7 @@ var GeoProp = {
* @return {Object}
*/
function getOffsetParent(node) {
let win = node.ownerDocument.defaultView;
let win = node.ownerGlobal;
let offsetParent = node.offsetParent;
if (offsetParent &&
@ -643,7 +643,7 @@ GeometryEditorHighlighter.prototype = extend(AutoRefreshHighlighter.prototype, {
if (GeoProp.isInverted(side)) {
return this.offsetParent.dimension[GeoProp.mainAxisSize(side)];
}
return -1 * this.currentNode.ownerDocument.defaultView["scroll" +
return -1 * this.currentNode.ownerGlobal["scroll" +
GeoProp.axis(side).toUpperCase()];
};

Просмотреть файл

@ -48,7 +48,7 @@ SimpleOutlineHighlighter.prototype = {
if (isNodeValid(node) && (!this.currentNode || node !== this.currentNode)) {
this.hide();
this.currentNode = node;
installHelperSheet(node.ownerDocument.defaultView, SIMPLE_OUTLINE_SHEET);
installHelperSheet(node.ownerGlobal, SIMPLE_OUTLINE_SHEET);
addPseudoClassLock(node, HIGHLIGHTED_PSEUDO_CLASS);
}
return true;

Просмотреть файл

@ -1825,7 +1825,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
if (!this.installedHelpers) {
this.installedHelpers = new WeakMap();
}
let win = node.rawNode.ownerDocument.defaultView;
let win = node.rawNode.ownerGlobal;
if (!this.installedHelpers.has(win)) {
let { Style } = require("sdk/stylesheet/style");
let { attach } = require("sdk/content/mod");
@ -3125,7 +3125,7 @@ function nodeHasSize(node) {
* fails to load or the load takes too long, the promise is rejected.
*/
function ensureImageLoaded(image, timeout) {
let { HTMLImageElement } = image.ownerDocument.defaultView;
let { HTMLImageElement } = image.ownerGlobal;
if (!(image instanceof HTMLImageElement)) {
return promise.reject("image must be an HTMLImageELement");
}
@ -3180,7 +3180,7 @@ function ensureImageLoaded(image, timeout) {
* If something goes wrong, the promise is rejected.
*/
var imageToImageData = Task.async(function* (node, maxDim) {
let { HTMLCanvasElement, HTMLImageElement } = node.ownerDocument.defaultView;
let { HTMLCanvasElement, HTMLImageElement } = node.ownerGlobal;
let isImg = node instanceof HTMLImageElement;
let isCanvas = node instanceof HTMLCanvasElement;

Просмотреть файл

@ -667,7 +667,7 @@ DevToolsUtils.makeInfallible(function (window) {
*/
for (let [browser, actor] of this._actorByBrowser) {
/* The browser document of a closed window has no default view. */
if (!browser.ownerDocument.defaultView) {
if (!browser.ownerGlobal) {
this._handleActorClose(actor, browser);
}
}

Просмотреть файл

@ -1782,7 +1782,7 @@ WebConsoleActor.prototype =
try {
window = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
.chromeEventHandler.ownerGlobal;
}
catch (ex) {
// The above can fail because chromeEventHandler is not available for all

Просмотреть файл

@ -580,7 +580,7 @@ BrowserElementChild.prototype = {
// Processes the "rel" field in <link> tags and forward to specific handlers.
_linkAddedHandler: function(e) {
let win = e.target.ownerDocument.defaultView;
let win = e.target.ownerGlobal;
// Ignore links which don't come from the top-level
// <iframe mozbrowser> window.
if (win != content) {
@ -606,7 +606,7 @@ BrowserElementChild.prototype = {
},
_metaChangedHandler: function(e) {
let win = e.target.ownerDocument.defaultView;
let win = e.target.ownerGlobal;
// Ignore metas which don't come from the top-level
// <iframe mozbrowser> window.
if (win != content) {

Просмотреть файл

@ -108,7 +108,7 @@ var CopyPasteAssistent = {
detail.rect.bottom += currentRect.top;
detail.rect.left += currentRect.left;
detail.rect.right += currentRect.left;
currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
currentWindow = currentWindow.realFrameElement.ownerGlobal;
let targetDocShell = currentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)

Просмотреть файл

@ -224,11 +224,11 @@ BrowserElementParent.prototype = {
_isAlive: function() {
return !Cu.isDeadWrapper(this._frameElement) &&
!Cu.isDeadWrapper(this._frameElement.ownerDocument) &&
!Cu.isDeadWrapper(this._frameElement.ownerDocument.defaultView);
!Cu.isDeadWrapper(this._frameElement.ownerGlobal);
},
get _window() {
return this._frameElement.ownerDocument.defaultView;
return this._frameElement.ownerGlobal;
},
get _windowUtils() {

Просмотреть файл

@ -29,7 +29,7 @@ function completeTest(aBox) {
}
function fireEvent(target, event) {
var win = target.ownerDocument.defaultView;
var win = target.ownerGlobal;
var utils =
win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
@ -61,7 +61,7 @@ function RunTest() {
synthesizeMouse(image, 20, 20, { type: "mouseup" });
var event = document.createEvent("DragEvent");
event.initDragEvent("dragover", true, true, iBox.ownerDocument.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, iBox, dataTransfer);
event.initDragEvent("dragover", true, true, iBox.ownerGlobal, 0, 0, 0, 0, 0, false, false, false, false, 0, iBox, dataTransfer);
fireEvent(iBox, event);
synthesizeMouse(image, 3, 3, { type: "mousedown" });
synthesizeMouse(image, 23, 23, { type: "mousemove" });

Просмотреть файл

@ -5,7 +5,7 @@ var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content
*/
function coordinatesRelativeToWindow(aX, aY, aElement) {
var targetWindow = aElement.ownerDocument.defaultView;
var targetWindow = aElement.ownerGlobal;
var scale = targetWindow.devicePixelRatio;
var rect = aElement.getBoundingClientRect();
return {

Просмотреть файл

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

Просмотреть файл

@ -93,7 +93,7 @@ function expectFocusShift(callback, expectedWindow, expectedElement, focusChange
{
if (expectedWindow == null)
expectedWindow = expectedElement ?
expectedElement.ownerDocument.defaultView :
expectedElement.ownerGlobal :
gLastFocusWindow;
var expectedEvents = "";
@ -308,20 +308,20 @@ function mouseWillTriggerFocus(element)
function mouseOnElement(element, expectedElement, focusChanged, testid)
{
var expectedWindow = (element.ownerDocument.defaultView == gChildWindow) ? gChildWindow : window;
var expectedWindow = (element.ownerGlobal == gChildWindow) ? gChildWindow : window;
// on Mac, form elements are not focused when clicking, except for lists and textboxes.
var noFocusOnMouse = !mouseWillTriggerFocus(element)
if (noFocusOnMouse) {
// no focus so the last focus method will be 0
gLastFocusMethod = 0;
expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerDocument.defaultView),
expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal),
expectedWindow, null, true, testid);
gLastFocusMethod = fm.FLAG_BYMOUSE;
}
else {
expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerDocument.defaultView),
element.ownerDocument.defaultView,
expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal),
element.ownerGlobal,
expectedElement, focusChanged, testid);
}
}
@ -456,7 +456,7 @@ function startTest()
continue;
mouseOnElement(element, getById("t" + idx), true, "mouse on element t" + idx);
var expectedWindow = (element.ownerDocument.defaultView == gChildWindow) ? gChildWindow : window;
var expectedWindow = (element.ownerGlobal == gChildWindow) ? gChildWindow : window;
if (element.localName == "listbox" && expectedWindow == window &&
navigator.platform.indexOf("Mac") == 0) {
// after focusing a listbox on Mac, clear the focus before continuing.
@ -487,7 +487,7 @@ function startTest()
if (idx == kOverflowElementIndex) {
gLastFocusMethod = fm.FLAG_BYMOUSE;
var element = getById("t" + idx);
expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerDocument.defaultView),
expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal),
window, null, true, "mouse on scrollable element");
}
@ -512,7 +512,7 @@ function startTest()
for (idx = 1; idx <= kFocusSteps; idx++) {
var expected = getById("o" + (idx % 2 ? idx : idx - 1));
expectFocusShift(() => getById("o" + idx).focus(),
expected.ownerDocument.defaultView,
expected.ownerGlobal,
expected, idx % 2, "focus method on non-tabbable element o" + idx);
}
@ -521,7 +521,7 @@ function startTest()
for (idx = 1; idx <= kNoFocusSteps; idx++) {
var expected = getById("o" + (idx % 2 ? idx : idx - 1));
expectFocusShift(() => getById("o" + idx).focus(),
expected.ownerDocument.defaultView,
expected.ownerGlobal,
expected, idx % 2, "focus method on unfocusable element n" + idx);
}
@ -553,7 +553,7 @@ function startTest()
// on Windows and Linux, the shift key must be pressed for content area access keys
// and on Mac, the alt key must be pressed for content area access keys
var isContent = (getById(keys[k]).ownerDocument.defaultView == gChildWindow);
var isContent = (getById(keys[k]).ownerGlobal == gChildWindow);
if (navigator.platform.indexOf("Mac") == -1) {
accessKeyDetails.shiftKey = isContent;
} else {
@ -629,7 +629,7 @@ function startTest()
var functions = [
element => element.focus(),
element => synthesizeMouse(element, 4, 4, { }, element.ownerDocument.defaultView)
element => synthesizeMouse(element, 4, 4, { }, element.ownerGlobal)
];
// first, check cases where the focus is adjusted during the blur event. Iterate twice,
@ -1117,7 +1117,7 @@ function otherWindowFocused(otherWindow)
is(fm.focusedElement.id, "other", "when lowered focusedElement t" + idx);
is(fm.focusedWindow, otherWindow, "when lowered focusedWindow t" + idx);
var checkWindow = expectedElement.ownerDocument.defaultView;
var checkWindow = expectedElement.ownerGlobal;
is(fm.getFocusedElementForWindow(checkWindow, false, {}).id, expectedElement.id,
"when lowered getFocusedElementForWindow t" + idx);
is(checkWindow.document.activeElement.id, expectedElement.id, "when lowered activeElement t" + idx);

Просмотреть файл

@ -31,7 +31,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
function onSpellCheck(editableElement, callback) {
let editor = editableElement.editor;
if (!editor) {
let win = editableElement.ownerDocument.defaultView;
let win = editableElement.ownerGlobal;
editor = win.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIWebNavigation).
QueryInterface(Ci.nsIInterfaceRequestor).

Просмотреть файл

@ -66,7 +66,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=987230
function synthesizeNativeMouseClick(aElement, aOffsetX, aOffsetY) {
let rect = aElement.getBoundingClientRect();
let win = aElement.ownerDocument.defaultView;
let win = aElement.ownerGlobal;
let x = aOffsetX + win.mozInnerScreenX + rect.left;
let y = aOffsetY + win.mozInnerScreenY + rect.top;

Просмотреть файл

@ -607,7 +607,7 @@ var CastingApps = {
}
// We only show pageactions if the <video> is from the selected tab
if (BrowserApp.selectedTab != BrowserApp.getTabForWindow(aVideo.ownerDocument.defaultView.top)) {
if (BrowserApp.selectedTab != BrowserApp.getTabForWindow(aVideo.ownerGlobal.top)) {
return;
}
@ -690,7 +690,7 @@ var CastingApps = {
return;
if (aVideo.element) {
aVideo.title = aVideo.element.ownerDocument.defaultView.top.document.title;
aVideo.title = aVideo.element.ownerGlobal.top.document.title;
// If the video is currently playing on the device, pause it
if (!aVideo.element.paused) {

Просмотреть файл

@ -52,7 +52,7 @@ var Feedback = {
break;
}
let win = event.target.ownerDocument.defaultView.top;
let win = event.target.ownerGlobal.top;
BrowserApp.closeTab(BrowserApp.getTabForWindow(win));
},

Просмотреть файл

@ -24,7 +24,7 @@ var InputWidgetHelper = {
show: function(aElement) {
let type = aElement.getAttribute('type');
let p = new Prompt({
window: aElement.ownerDocument.defaultView,
window: aElement.ownerGlobal,
title: Strings.browser.GetStringFromName("inputWidgetHelper." + aElement.getAttribute('type')),
buttons: [
Strings.browser.GetStringFromName("inputWidgetHelper.set"),

Просмотреть файл

@ -177,7 +177,7 @@ var PluginHelper = {
if (!e.isTrusted)
return;
e.preventDefault();
let win = e.target.ownerDocument.defaultView.top;
let win = e.target.ownerGlobal.top;
let tab = BrowserApp.getTabForWindow(win);
tab.clickToPlayPluginsActivated = true;
PluginHelper.playAllPlugins(win);

Просмотреть файл

@ -56,7 +56,7 @@ var SelectHelper = {
show: function(element) {
let list = this.getListForElement(element);
let p = new Prompt({
window: element.ownerDocument.defaultView
window: element.ownerGlobal
});
if (element.multiple) {

Просмотреть файл

@ -1538,7 +1538,7 @@ var BrowserApp = {
// we are putting focus into a contentEditable frame. scroll the frame into
// view instead of the contentEditable document contained within, because that
// results in a better user experience
focused = focused.ownerDocument.defaultView.frameElement;
focused = focused.ownerGlobal.frameElement;
}
return focused;
}
@ -2924,7 +2924,7 @@ var NativeWindow = {
let useTabs = Object.keys(this.menus).length > 1;
let prompt = new Prompt({
window: target.ownerDocument.defaultView,
window: target.ownerGlobal,
title: useTabs ? undefined : title
});
@ -3081,7 +3081,7 @@ var LightWeightThemeWebInstaller = {
case "PreviewBrowserTheme":
case "ResetBrowserThemePreview":
// ignore requests from background tabs
if (event.target.ownerDocument.defaultView.top != content)
if (event.target.ownerGlobal.top != content)
return;
}
@ -3158,7 +3158,7 @@ var LightWeightThemeWebInstaller = {
return;
this._resetPreview();
this._previewWindow = event.target.ownerDocument.defaultView;
this._previewWindow = event.target.ownerGlobal;
this._previewWindow.addEventListener("pagehide", this, true);
BrowserApp.deck.addEventListener("TabSelect", this);
this._manager.previewTheme(data);
@ -4807,7 +4807,7 @@ const ElementTouchHelper = {
let r = aElement.getBoundingClientRect();
// step out of iframes and frames, offsetting scroll values
for (let frame = aElement.ownerDocument.defaultView; frame.frameElement && frame != content; frame = frame.parent) {
for (let frame = aElement.ownerGlobal; frame.frameElement && frame != content; frame = frame.parent) {
// adjust client coordinates' origin to be top left of iframe viewport
let rect = frame.frameElement.getBoundingClientRect();
let left = frame.getComputedStyle(frame.frameElement).borderLeftWidth;
@ -5032,7 +5032,7 @@ var FormAssistant = {
// Ignore this notificaiton if the current tab doesn't contain the invalid element
let currentElement = aInvalidElements.queryElementAt(0, Ci.nsISupports);
if (BrowserApp.selectedBrowser.contentDocument !=
currentElement.ownerDocument.defaultView.top.document)
currentElement.ownerGlobal.top.document)
return;
this._invalidSubmit = true;

Просмотреть файл

@ -71,7 +71,7 @@ ContentPermissionPrompt.prototype = {
let requestingWindow = request.window.top;
return this.getChromeWindow(requestingWindow).wrappedJSObject;
}
return request.element.ownerDocument.defaultView;
return request.element.ownerGlobal;
},
prompt: function(request) {

Просмотреть файл

@ -344,7 +344,7 @@ LoginManagerPrompter.prototype = {
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
.chromeEventHandler.ownerGlobal;
return chromeWin;
},

Просмотреть файл

@ -387,7 +387,7 @@ SessionStore.prototype = {
},
handleEvent: function ss_handleEvent(aEvent) {
let window = aEvent.currentTarget.ownerDocument.defaultView;
let window = aEvent.currentTarget.ownerGlobal;
switch (aEvent.type) {
case "TabOpen": {
let browser = aEvent.target;

Просмотреть файл

@ -166,7 +166,7 @@ handlers.wifi = {
// Even at this point, Android sometimes lies about the real state of the network and this reload request fails.
// Add a 500ms delay before refreshing the page.
node.ownerDocument.defaultView.setTimeout(function() {
node.ownerGlobal.setTimeout(function() {
node.ownerDocument.location.reload(false);
}, 500);
}

Просмотреть файл

@ -1,4 +1,4 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -57,7 +57,7 @@ function isInputOrTextarea(element) {
function elementSelection(element) {
return (isInputOrTextarea(element)) ?
element.editor.selection :
element.ownerDocument.defaultView.getSelection();
element.ownerGlobal.getSelection();
}
/**

Просмотреть файл

@ -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();
let browser = gBrowser.getBrowserForTab(tab);
// wait for tab load

Просмотреть файл

@ -851,7 +851,7 @@ MozMillController.prototype.mouseMove = function (doc, start, dest) {
var evt = element.ownerDocument.createEvent('MouseEvents');
if (evt.initMouseEvent) {
evt.initMouseEvent('mousemove', true, true, element.ownerDocument.defaultView,
evt.initMouseEvent('mousemove', true, true, element.ownerGlobal,
1, screenX, screenY, clientX, clientY);
} else {
evt.initEvent('mousemove', true, true);

Просмотреть файл

@ -378,10 +378,10 @@ MozMillElement.prototype.mouseEvent = function (aOffsetX, aOffsetY, aEvent, aExp
EventUtils.synthesizeMouseExpectEvent(this.element, aOffsetX, aOffsetY, aEvent,
target, aExpectedEvent.type,
"MozMillElement.mouseEvent()",
this.element.ownerDocument.defaultView);
this.element.ownerGlobal);
} else {
EventUtils.synthesizeMouse(this.element, aOffsetX, aOffsetY, aEvent,
this.element.ownerDocument.defaultView);
this.element.ownerGlobal);
}
// Bug 555347
@ -569,7 +569,7 @@ MozMillElement.prototype.touchEvent = function (aOffsetX, aOffsetY, aEvent) {
}
EventUtils.synthesizeTouch(this.element, aOffsetX, aOffsetY, aEvent,
this.element.ownerDocument.defaultView);
this.element.ownerGlobal);
return true;
};

Просмотреть файл

@ -269,7 +269,7 @@ function waitFor(callback, message, timeout, interval, thisObject) {
* Note this function will not work if the user has custom toolbars (via extension) at the bottom or left/right of the screen
*/
function getChromeOffset(elem) {
var win = elem.ownerDocument.defaultView;
var win = elem.ownerGlobal;
// Calculate x offset
var chromeWidth = 0;
@ -304,7 +304,7 @@ function takeScreenshot(node, highlights) {
// node can be either a window or an arbitrary DOM node
try {
// node is an arbitrary DOM node
win = node.ownerDocument.defaultView;
win = node.ownerGlobal;
rect = node.getBoundingClientRect();
width = rect.width;
height = rect.height;

Просмотреть файл

@ -329,7 +329,7 @@ accessibility.Checks = class {
return;
}
let win = element.ownerDocument.defaultView;
let win = element.ownerGlobal;
let disabledAccessibility = this.matchState(
accessible, accessibility.State.Unavailable);
let explorable = win.getComputedStyle(element)

Просмотреть файл

@ -35,7 +35,7 @@ capture.Format = {
* The canvas element where the element has been painted on.
*/
capture.element = function (node, highlights = []) {
let win = node.ownerDocument.defaultView;
let win = node.ownerGlobal;
let rect = node.getBoundingClientRect();
return capture.canvas(

Просмотреть файл

@ -882,7 +882,7 @@ element.coordinates = function (
* True if if |el| is in viewport, false otherwise.
*/
element.inViewport = function (el, x = undefined, y = undefined) {
let win = el.ownerDocument.defaultView;
let win = el.ownerGlobal;
let c = element.coordinates(el, x, y);
let vp = {
top: win.pageYOffset,
@ -916,7 +916,7 @@ element.inViewport = function (el, x = undefined, y = undefined) {
* True if visible, false otherwise.
*/
element.isVisible = function (el, x = undefined, y = undefined) {
let win = el.ownerDocument.defaultView;
let win = el.ownerGlobal;
// Bug 1094246: webdriver's isShown doesn't work with content xul
if (!element.isXULElement(el) && !atom.isElementDisplayed(el, win)) {

Просмотреть файл

@ -78,7 +78,7 @@ event.sendMouseEvent = function (mouseEvent, target, window = undefined) {
if (!target.nodeType) {
target = window.document.getElementById(target);
} else {
window = window || target.ownerDocument.defaultView;
window = window || target.ownerGlobal;
}
let ev = window.document.createEvent("MouseEvent");

Просмотреть файл

@ -395,5 +395,5 @@ interaction.isElementSelected = function (el, strict = false) {
};
function getWindow(el) {
return el.ownerDocument.defaultView;
return el.ownerGlobal;
}

Просмотреть файл

@ -318,7 +318,7 @@ action.Chain.prototype.actions = function (chain, touchId, i, keyModifiers, cb)
* form [clientX, clientY, pageX, pageY, screenX, screenY].
*/
action.Chain.prototype.getCoordinateInfo = function (el, corx, cory) {
let win = el.ownerDocument.defaultView;
let win = el.ownerGlobal;
return [
corx, // clientX
cory, // clientY
@ -449,7 +449,7 @@ action.Chain.prototype.generateEvents = function (
"contextmenu",
true,
true,
target.ownerDocument.defaultView,
target.ownerGlobal,
1,
screenX,
screenY,

Просмотреть файл

@ -75,9 +75,9 @@ this.BrowserTestUtils = {
}
}
let tab = yield BrowserTestUtils.openNewForegroundTab(options.gBrowser, options.url);
let originalWindow = tab.ownerDocument.defaultView;
let originalWindow = tab.ownerGlobal;
let result = yield taskFn(tab.linkedBrowser);
let finalWindow = tab.ownerDocument.defaultView;
let finalWindow = tab.ownerGlobal;
if (originalWindow == finalWindow && !tab.closing && tab.linkedBrowser) {
yield BrowserTestUtils.removeTab(tab);
} else {
@ -192,7 +192,7 @@ this.BrowserTestUtils = {
}
return new Promise(resolve => {
let mm = browser.ownerDocument.defaultView.messageManager;
let mm = browser.ownerGlobal.messageManager;
mm.addMessageListener("browser-test-utils:loadEvent", function onLoad(msg) {
if (msg.target == browser && (!msg.data.subframe || includeSubFrames) &&
isWanted(msg.data.url)) {
@ -390,7 +390,7 @@ this.BrowserTestUtils = {
browser.loadURI(uri);
// Nothing to do in non-e10s mode.
if (!browser.ownerDocument.defaultView.gMultiProcessBrowser) {
if (!browser.ownerGlobal.gMultiProcessBrowser) {
return;
}
@ -690,7 +690,7 @@ this.BrowserTestUtils = {
let waitForLoad = () =>
this.waitForContentEvent(browser, "AboutNetErrorLoad", false, null, true);
let win = browser.ownerDocument.defaultView;
let win = browser.ownerGlobal;
let tab = win.gBrowser.getTabForBrowser(browser);
if (!tab || browser.isRemoteBrowser || !win.gMultiProcessBrowser) {
return waitForLoad();
@ -820,7 +820,7 @@ this.BrowserTestUtils = {
}, true);
if (!dontRemove && !tab.closing) {
tab.ownerDocument.defaultView.gBrowser.removeTab(tab);
tab.ownerGlobal.gBrowser.removeTab(tab);
}
});
},
@ -979,7 +979,7 @@ this.BrowserTestUtils = {
yield Promise.all(expectedPromises);
if (shouldShowTabCrashPage) {
let gBrowser = browser.ownerDocument.defaultView.gBrowser;
let gBrowser = browser.ownerGlobal.gBrowser;
let tab = gBrowser.getTabForBrowser(browser);
if (tab.getAttribute("crashed") != "true") {
throw new Error("Tab should be marked as crashed");
@ -1002,7 +1002,7 @@ this.BrowserTestUtils = {
* @returns {Promise}
*/
waitForAttribute(attr, element, value) {
let MutationObserver = element.ownerDocument.defaultView.MutationObserver;
let MutationObserver = element.ownerGlobal.MutationObserver;
return new Promise(resolve => {
let mut = new MutationObserver(mutations => {
if ((!value && element.getAttribute(attr)) ||

Просмотреть файл

@ -41,7 +41,7 @@ addMessageListener("Test:SynthesizeMouse", (message) => {
// Account for nodes found in iframes.
let cur = target;
do {
let frame = cur.ownerDocument.defaultView.frameElement;
let frame = cur.ownerGlobal.frameElement;
let rect = frame.getBoundingClientRect();
left += rect.left;

Просмотреть файл

@ -442,7 +442,7 @@ var EventTargetParent = {
// Check if |target| is somewhere on the patch from the
// <tabbrowser> up to the root element.
let window = target.ownerDocument.defaultView;
let window = target.ownerGlobal;
if (window && target.contains(window.gBrowser)) {
return window;
}
@ -455,7 +455,7 @@ var EventTargetParent = {
// <browser> element and the window since those are the two possible
// results of redirectEventTarget.
getTargets(browser) {
let window = browser.ownerDocument.defaultView;
let window = browser.ownerGlobal;
return [browser, window];
},
@ -706,7 +706,7 @@ ContentDocShellTreeItemInterposition.getters.rootTreeItem =
return null;
}
let chromeWin = browser.ownerDocument.defaultView;
let chromeWin = browser.ownerGlobal;
// Return that window's docshell.
return chromeWin.QueryInterface(Ci.nsIInterfaceRequestor)
@ -981,7 +981,7 @@ function wrapProgressListener(kind, listener) {
}
TabBrowserElementInterposition.methods.addProgressListener = function(addon, target, listener) {
if (!target.ownerDocument.defaultView.gMultiProcessBrowser) {
if (!target.ownerGlobal.gMultiProcessBrowser) {
return target.addProgressListener(listener);
}
@ -990,7 +990,7 @@ TabBrowserElementInterposition.methods.addProgressListener = function(addon, tar
};
TabBrowserElementInterposition.methods.removeProgressListener = function(addon, target, listener) {
if (!target.ownerDocument.defaultView.gMultiProcessBrowser) {
if (!target.ownerGlobal.gMultiProcessBrowser) {
return target.removeProgressListener(listener);
}
@ -999,7 +999,7 @@ TabBrowserElementInterposition.methods.removeProgressListener = function(addon,
};
TabBrowserElementInterposition.methods.addTabsProgressListener = function(addon, target, listener) {
if (!target.ownerDocument.defaultView.gMultiProcessBrowser) {
if (!target.ownerGlobal.gMultiProcessBrowser) {
return target.addTabsProgressListener(listener);
}
@ -1008,7 +1008,7 @@ TabBrowserElementInterposition.methods.addTabsProgressListener = function(addon,
};
TabBrowserElementInterposition.methods.removeTabsProgressListener = function(addon, target, listener) {
if (!target.ownerDocument.defaultView.gMultiProcessBrowser) {
if (!target.ownerGlobal.gMultiProcessBrowser) {
return target.removeTabsProgressListener(listener);
}

Просмотреть файл

@ -320,7 +320,7 @@ Highlighter.prototype = {
let containerRect = this.container.getBoundingClientRect();
let range = this._getRange(startOffset, startOffset + length);
let rangeRects = range.getClientRects();
let win = this.container.ownerDocument.defaultView;
let win = this.container.ownerGlobal;
let computedStyle = win.getComputedStyle(range.endContainer.parentNode);
let nodes = this._getFreshHighlightNodes(rangeRects.length);

Просмотреть файл

@ -25,7 +25,7 @@ this.NarrateTestUtils = {
FORWARD: "#narrate-skip-next",
isVisible(element) {
let style = element.ownerDocument.defaultView.getComputedStyle(element);
let style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none") {
return false;
} else if (style.visibility != "visible") {

Просмотреть файл

@ -276,7 +276,7 @@ var LoginManagerParent = {
// nsAutoCompleteController).
if (remote) {
let results = new UserAutoCompleteResult(searchString, matchingLogins, {isSecure});
AutoCompletePopup.showPopupWithResults({ browser: target.ownerDocument.defaultView, rect, results });
AutoCompletePopup.showPopupWithResults({ browser: target.ownerGlobal, rect, results });
}
// Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
@ -295,7 +295,7 @@ var LoginManagerParent = {
function getPrompter() {
var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
createInstance(Ci.nsILoginManagerPrompter);
prompterSvc.init(target.ownerDocument.defaultView);
prompterSvc.init(target.ownerGlobal);
prompterSvc.browser = target;
prompterSvc.opener = openerTopWindow;
return prompterSvc;
@ -484,7 +484,7 @@ var LoginManagerParent = {
state.hasInsecureLoginForms = hasInsecureLoginForms;
// Report the insecure login form state immediately.
browser.dispatchEvent(new browser.ownerDocument.defaultView
browser.dispatchEvent(new browser.ownerGlobal
.CustomEvent("InsecureLoginFormsStateChange"));
},
};

Просмотреть файл

@ -28,7 +28,7 @@ function synthesizeDblClickOnCell(aTree, column, row) {
let y = rect.y + rect.height / 2;
// Simulate the double click.
EventUtils.synthesizeMouse(aTree.body, x, y, { clickCount: 2 },
aTree.ownerDocument.defaultView);
aTree.ownerGlobal);
}
function* togglePasswords() {

Просмотреть файл

@ -26,7 +26,7 @@ function getPopupNotifications(aWindow) {
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
.chromeEventHandler.ownerGlobal;
var popupNotifications = chromeWin.PopupNotifications;
return popupNotifications;
@ -100,7 +100,7 @@ function dumpNotifications() {
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
.chromeEventHandler.ownerGlobal;
var nb = chromeWin.getNotificationBox(window.top);
notes = nb.allNotifications;
ok(true, "Found " + notes.length + " notification bars.");

Просмотреть файл

@ -52,7 +52,7 @@ MainProcessSingleton.prototype = {
var title = searchBundle.GetStringFromName("error_invalid_engine_title");
var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
[brandName], 1);
Services.ww.getNewPrompter(browser.ownerDocument.defaultView).alert(title, msg);
Services.ww.getNewPrompter(browser.ownerGlobal).alert(title, msg);
return;
}

Просмотреть файл

@ -299,8 +299,7 @@ var PromptUtilsTemp = {
var chromeWin = promptWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument
.defaultView.wrappedJSObject;
.chromeEventHandler.ownerGlobal.wrappedJSObject;
if (chromeWin.getTabModalPromptBox)
promptBox = chromeWin.getTabModalPromptBox(promptWin);

Просмотреть файл

@ -144,7 +144,7 @@ this.AutoCompletePopup = {
return;
}
let window = browser.ownerDocument.defaultView;
let window = browser.ownerGlobal;
let tabbrowser = window.gBrowser;
if (Services.focus.activeWindow != window ||
tabbrowser.selectedBrowser != browser) {

Просмотреть файл

@ -47,7 +47,7 @@ function isAutocompleteDisabled(aField) {
*/
function FormHistoryClient({ formField, inputName }) {
if (formField && inputName != this.SEARCHBAR_ID) {
let window = formField.ownerDocument.defaultView;
let window = formField.ownerGlobal;
let topDocShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.sameTypeRootTreeItem

Просмотреть файл

@ -19,7 +19,7 @@ TooltipTextProvider.prototype = {
return false;
}
var defView = tipElement.ownerDocument.defaultView;
var defView = tipElement.ownerGlobal;
// XXX Work around bug 350679:
// "Tooltips can be fired in documents with no view".
if (!defView)

Просмотреть файл

@ -84,10 +84,10 @@ var ClickEventHandler = {
continue;
}
var overflowx = this._scrollable.ownerDocument.defaultView
var overflowx = this._scrollable.ownerGlobal
.getComputedStyle(this._scrollable)
.getPropertyValue("overflow-x");
var overflowy = this._scrollable.ownerDocument.defaultView
var overflowy = this._scrollable.ownerGlobal
.getComputedStyle(this._scrollable)
.getPropertyValue("overflow-y");
// we already discarded non-multiline selects so allow vertical
@ -111,7 +111,7 @@ var ClickEventHandler = {
}
if (!this._scrollable) {
this._scrollable = aNode.ownerDocument.defaultView;
this._scrollable = aNode.ownerGlobal;
if (this._scrollable.scrollMaxX != this._scrollable.scrollMinX) {
this._scrolldir = this._scrollable.scrollMaxY !=
this._scrollable.scrollMinY ? "NSEW" : "EW";
@ -936,7 +936,7 @@ addMessageListener("WebChannelMessageToContent", function(e) {
if (e.principal.subsumes(targetPrincipal)) {
// If eventTarget is a window, use it as the targetWindow, otherwise
// find the window that owns the eventTarget.
let targetWindow = eventTarget instanceof Ci.nsIDOMWindow ? eventTarget : eventTarget.ownerDocument.defaultView;
let targetWindow = eventTarget instanceof Ci.nsIDOMWindow ? eventTarget : eventTarget.ownerGlobal;
eventTarget.dispatchEvent(new targetWindow.CustomEvent("WebChannelMessageToContent", {
detail: Cu.cloneInto({
@ -1240,7 +1240,7 @@ var ViewSelectionSource = {
* Some element within the fragment of interest.
*/
getMathMLSelection(node) {
var Node = node.ownerDocument.defaultView.Node;
var Node = node.ownerGlobal.Node;
this._lineCount = 0;
this._startTargetLine = 0;
this._endTargetLine = 0;
@ -1297,7 +1297,7 @@ var ViewSelectionSource = {
},
getOuterMarkup(node, indent) {
var Node = node.ownerDocument.defaultView.Node;
var Node = node.ownerGlobal.Node;
var newline = "";
var padding = "";
var str = "";
@ -1546,7 +1546,7 @@ let AutoCompletePopup = {
}
let rect = BrowserUtils.getElementBoundingScreenRect(element);
let window = element.ownerDocument.defaultView;
let window = element.ownerGlobal;
let dir = window.getComputedStyle(element).direction;
let results = this.getResultsFromController(input);
@ -1667,7 +1667,7 @@ let DateTimePickerListener = {
* Helper function that returns the CSS direction property of the element.
*/
getComputedDirection(aElement) {
return aElement.ownerDocument.defaultView.getComputedStyle(aElement)
return aElement.ownerGlobal.getComputedStyle(aElement)
.getPropertyValue("direction");
},

Просмотреть файл

@ -797,7 +797,7 @@ function isUnwantedDragEvent(aEvent) {
if (!mozSourceNode) {
return true;
}
let sourceWindow = mozSourceNode.ownerDocument.defaultView;
let sourceWindow = mozSourceNode.ownerGlobal;
return sourceWindow != window && sourceWindow != gToolboxDocument.defaultView;
}

Просмотреть файл

@ -228,7 +228,7 @@ function checkPanelPosition(panel)
let anchor = panel.anchorNode;
let adj = 0, hwinpos = 0, vwinpos = 0;
if (anchor.ownerDocument != document) {
var framerect = anchor.ownerDocument.defaultView.frameElement.getBoundingClientRect();
var framerect = anchor.ownerGlobal.frameElement.getBoundingClientRect();
hwinpos = framerect.left;
vwinpos = framerect.top;
}

Просмотреть файл

@ -72,7 +72,7 @@ function* expectLink(browser, expectedLinks, data, testid, onbody=false) {
function dropOnBrowserSync() {
let dropEl = onbody ? browser.contentDocument.body : browser;
synthesizeDrop(dropEl, dropEl, data, "", dropEl.ownerDocument.defaultView);
synthesizeDrop(dropEl, dropEl, data, "", dropEl.ownerGlobal);
}
let links;
if (browser.isRemoteBrowser) {

Просмотреть файл

@ -51,7 +51,7 @@ let observer = {
function countReflows(testfn, expected) {
let deferred = Promise.defer();
observer.reflows = [];
let docShell = panel.ownerDocument.defaultView
let docShell = panel.ownerGlobal
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShell);

Просмотреть файл

@ -843,7 +843,7 @@
this.showImageColumn = this.mInput.showImageColumn;
var rect = aElement.getBoundingClientRect();
var nav = aElement.ownerDocument.defaultView.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
var nav = aElement.ownerGlobal.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation);
var docShell = nav.QueryInterface(Components.interfaces.nsIDocShell);
var docViewer = docShell.contentViewer;
@ -851,7 +851,7 @@
this.setAttribute("width", width > 100 ? width : 100);
// Adjust the direction of the autocomplete popup list based on the textbox direction, bug 649840
var popupDirection = aElement.ownerDocument.defaultView.getComputedStyle(aElement).direction;
var popupDirection = aElement.ownerGlobal.getComputedStyle(aElement).direction;
this.style.direction = popupDirection;
this.openPopup(aElement, "after_start", 0, 0, false, false);

Просмотреть файл

@ -82,7 +82,7 @@
<body>
<![CDATA[
// if the node isn't visible, don't descend into it.
var cs = node.ownerDocument.defaultView.getComputedStyle(node);
var cs = node.ownerGlobal.getComputedStyle(node);
if (cs.visibility != "visible" || cs.display == "none") {
return NodeFilter.FILTER_REJECT;
}

Просмотреть файл

@ -670,7 +670,7 @@
<body>
<![CDATA[
if (this._scrollTimer) {
this.ownerDocument.defaultView.clearInterval(this._scrollTimer);
this.ownerGlobal.clearInterval(this._scrollTimer);
this._scrollTimer = 0;
}
]]>
@ -744,7 +744,7 @@
let scrollAmount = event.screenY <= popupRect.top ? -1 : 1;
this.scrollBox.scrollByIndex(scrollAmount);
let win = this.ownerDocument.defaultView;
let win = this.ownerGlobal;
this._scrollTimer = win.setInterval(() => {
this.scrollBox.scrollByIndex(scrollAmount);
}, this.AUTOSCROLL_INTERVAL);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше