зеркало из https://github.com/mozilla/gecko-dev.git
merge fx-team to mozilla-central a=merge
This commit is contained in:
Коммит
c1adcb3fe5
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -71,7 +71,7 @@ SearchProvider.prototype = {
|
|||
},
|
||||
|
||||
manageEngines(browser) {
|
||||
const browserWin = browser.ownerDocument.defaultView;
|
||||
const browserWin = browser.ownerGlobal;
|
||||
browserWin.openPreferences("paneSearch");
|
||||
},
|
||||
|
||||
|
|
|
@ -315,8 +315,8 @@ BrowserGlue.prototype = {
|
|||
case "fxaccounts:device_disconnected":
|
||||
this._onDeviceDisconnected();
|
||||
break;
|
||||
case "weave:engine:clients:display-uri":
|
||||
this._onDisplaySyncURI(subject);
|
||||
case "weave:engine:clients:display-uris":
|
||||
this._onDisplaySyncURIs(subject);
|
||||
break;
|
||||
case "session-save":
|
||||
this._setPrefToSaveSession(true);
|
||||
|
@ -534,7 +534,7 @@ BrowserGlue.prototype = {
|
|||
os.addObserver(this, "weave:service:ready", false);
|
||||
os.addObserver(this, "fxaccounts:onverified", false);
|
||||
os.addObserver(this, "fxaccounts:device_disconnected", false);
|
||||
os.addObserver(this, "weave:engine:clients:display-uri", false);
|
||||
os.addObserver(this, "weave:engine:clients:display-uris", false);
|
||||
os.addObserver(this, "session-save", false);
|
||||
os.addObserver(this, "places-init-complete", false);
|
||||
this._isPlacesInitObserver = true;
|
||||
|
@ -601,7 +601,7 @@ BrowserGlue.prototype = {
|
|||
os.removeObserver(this, "weave:service:ready");
|
||||
os.removeObserver(this, "fxaccounts:onverified");
|
||||
os.removeObserver(this, "fxaccounts:device_disconnected");
|
||||
os.removeObserver(this, "weave:engine:clients:display-uri");
|
||||
os.removeObserver(this, "weave:engine:clients:display-uris");
|
||||
os.removeObserver(this, "session-save");
|
||||
if (this._bookmarksBackupIdleTime) {
|
||||
this._idleService.removeIdleObserver(this, this._bookmarksBackupIdleTime);
|
||||
|
@ -2436,24 +2436,59 @@ BrowserGlue.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Called as an observer when Sync's "display URI" notification is fired.
|
||||
* Called as an observer when Sync's "display URIs" notification is fired.
|
||||
*
|
||||
* We open the received URI in a background tab.
|
||||
*
|
||||
* Eventually, this will likely be replaced by a more robust tab syncing
|
||||
* feature. This functionality is considered somewhat evil by UX because it
|
||||
* opens a new tab automatically without any prompting. However, it is a
|
||||
* lesser evil than sending a tab to a specific device (from e.g. Fennec)
|
||||
* and having nothing happen on the receiving end.
|
||||
* We open the received URIs in background tabs.
|
||||
*/
|
||||
_onDisplaySyncURI: function _onDisplaySyncURI(data) {
|
||||
_onDisplaySyncURIs: function _onDisplaySyncURIs(data) {
|
||||
try {
|
||||
let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser;
|
||||
|
||||
// The payload is wrapped weirdly because of how Sync does notifications.
|
||||
tabbrowser.addTab(data.wrappedJSObject.object.uri);
|
||||
const URIs = data.wrappedJSObject.object;
|
||||
|
||||
const findWindow = () => RecentWindow.getMostRecentBrowserWindow({private: false});
|
||||
|
||||
// win can be null, but it's ok, we'll assign it later in openTab()
|
||||
let win = findWindow();
|
||||
|
||||
const openTab = URI => {
|
||||
let tab;
|
||||
if (!win) {
|
||||
Services.appShell.hiddenDOMWindow.open(URI.uri);
|
||||
win = findWindow();
|
||||
tab = win.gBrowser.tabs[0];
|
||||
} else {
|
||||
tab = win.gBrowser.addTab(URI.uri);
|
||||
}
|
||||
tab.setAttribute("attention", true);
|
||||
return tab;
|
||||
};
|
||||
|
||||
const firstTab = openTab(URIs[0]);
|
||||
URIs.slice(1).forEach(URI => openTab(URI));
|
||||
|
||||
let title, body;
|
||||
const deviceName = Weave.Service.clientsEngine.getClientName(URIs[0].clientId);
|
||||
const bundle = Services.strings.createBundle("chrome://browser/locale/accounts.properties");
|
||||
if (URIs.length == 1) {
|
||||
title = bundle.GetStringFromName("tabArrivingNotification.title");
|
||||
const pageTitle = URIs[0].title || firstTab.linkedBrowser.contentTitle
|
||||
|| URIs[0].uri;
|
||||
body = bundle.formatStringFromName("tabArrivingNotification.body", [pageTitle, deviceName], 2);
|
||||
} else {
|
||||
title = bundle.GetStringFromName("tabsArrivingNotification.title");
|
||||
const tabArrivingBody = URIs.every(URI => URI.clientId == URIs[0].clientId) ?
|
||||
"tabsArrivingNotification.body" : "tabsArrivingNotificationMultiple.body";
|
||||
body = bundle.formatStringFromName(tabArrivingBody, [URIs.length, deviceName], 2);
|
||||
}
|
||||
|
||||
const clickCallback = (subject, topic, data) => {
|
||||
if (topic == "alertclickcallback") {
|
||||
win.gBrowser.selectedTab = firstTab;
|
||||
}
|
||||
}
|
||||
AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
|
||||
} catch (ex) {
|
||||
Cu.reportError("Error displaying tab received by Sync: " + ex);
|
||||
Cu.reportError("Error displaying tab(s) received by Sync: " + ex);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2559,7 +2594,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.
|
||||
|
@ -2762,7 +2797,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.
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ var Pocket = {
|
|||
},
|
||||
|
||||
onPanelViewHiding(event) {
|
||||
let window = event.target.ownerDocument.defaultView;
|
||||
let window = event.target.ownerGlobal;
|
||||
window.pktUI.pocketPanelDidHide(event);
|
||||
},
|
||||
|
||||
|
|
|
@ -38,3 +38,18 @@ deviceDisconnectedNotification.body = This computer has been successfully discon
|
|||
# LOCALIZATION NOTE (sendTabToAllDevices.menuitem)
|
||||
# Displayed in the Send Tabs context menu when right clicking a tab, a page or a link.
|
||||
sendTabToAllDevices.menuitem = All Devices
|
||||
|
||||
# LOCALIZATION NOTE (tabArrivingNotification.title, tabArrivingNotification.body,
|
||||
# tabsArrivingNotification.title, tabsArrivingNotification.body)
|
||||
# These strings are used in a notification shown when we're opening tab(s) another device sent us to display.
|
||||
tabArrivingNotification.title = Tab received
|
||||
# LOCALIZATION NOTE (tabArrivingNotification.body) %1 is the title of the tab and %2 is the device name.
|
||||
tabArrivingNotification.body = “%1$S” has arrived from %2$S.
|
||||
|
||||
tabsArrivingNotification.title = Multiple tabs received
|
||||
# LOCALIZATION NOTE (tabsArrivingNotification.body) %1 is the number of tabs received and %2 is the device name.
|
||||
tabsArrivingNotification.body = %1$S tabs have arrived from %2$S.
|
||||
# LOCALIZATION NOTE (tabsArrivingNotificationMultiple.body)
|
||||
# This string is used in a notification shown when we're opening tab(s) that several devices sent us to display.
|
||||
# %S is the number of tabs received
|
||||
tabsArrivingNotificationMultiple.body = %S tabs have arrived from your connected devices.
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
},
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -68,7 +68,7 @@ define(function (require, exports, module) {
|
|||
key: "more",
|
||||
object: objectLink({
|
||||
object: this.props.object
|
||||
}, "more...")
|
||||
}, "more…")
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ define(function (require, exports, module) {
|
|||
let tooltip = "Circular reference";
|
||||
return (
|
||||
DOM.span({title: tooltip},
|
||||
"[...]")
|
||||
"[…]")
|
||||
);
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -94,7 +94,7 @@ define(function (require, exports, module) {
|
|||
key: "more",
|
||||
object: objectLink({
|
||||
object: this.props.object
|
||||
}, "more...")
|
||||
}, "more…")
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ define(function (require, exports, module) {
|
|||
render: function () {
|
||||
return (
|
||||
span({title: "Circular reference"},
|
||||
"[...]"
|
||||
"[…]"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ define(function (require, exports, module) {
|
|||
|
||||
if (props.length <= max) {
|
||||
// There are not enough props yet (or at least, not enough props to
|
||||
// be able to know whether we should print "more..." or not).
|
||||
// be able to know whether we should print "more…" or not).
|
||||
// Let's display also empty members and functions.
|
||||
props = props.concat(this.getProps(object, max, (t, value) => {
|
||||
return !isInterestingProp(t, value);
|
||||
|
@ -83,7 +83,7 @@ define(function (require, exports, module) {
|
|||
|
||||
// getProps() can return max+1 properties (it can't return more)
|
||||
// to indicate that there is more props than allowed. Remove the last
|
||||
// one and append 'more...' postfix in such case.
|
||||
// one and append 'more…' postfix in such case.
|
||||
if (props.length > max) {
|
||||
props.pop();
|
||||
|
||||
|
@ -93,7 +93,7 @@ define(function (require, exports, module) {
|
|||
key: "more",
|
||||
object: objectLink({
|
||||
object: object
|
||||
}, "more...")
|
||||
}, "more…")
|
||||
}));
|
||||
} else if (props.length > 0) {
|
||||
// Remove the last comma.
|
||||
|
|
|
@ -55,7 +55,7 @@ define(function (require, exports, module) {
|
|||
key: "more",
|
||||
object: objectLink({
|
||||
object: this.props.object
|
||||
}, "more...")
|
||||
}, "more…")
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ define(function (require, exports, module) {
|
|||
|
||||
if (props.length <= max) {
|
||||
// There are not enough props yet (or at least, not enough props to
|
||||
// be able to know whether we should print "more..." or not).
|
||||
// be able to know whether we should print "more…" or not).
|
||||
// Let's display also empty members and functions.
|
||||
props = props.concat(this.getProps(object, max, (t, value) => {
|
||||
return !isInterestingProp(t, value);
|
||||
|
@ -86,7 +86,7 @@ define(function (require, exports, module) {
|
|||
key: "more",
|
||||
object: objectLink({
|
||||
object: object
|
||||
}, "more...")
|
||||
}, "more…")
|
||||
}));
|
||||
} else if (props.length > 0) {
|
||||
// Remove the last comma.
|
||||
|
|
|
@ -95,7 +95,7 @@ window.onload = Task.async(function* () {
|
|||
|
||||
function testMoreThanMaxProps() {
|
||||
const stub = Array(302).fill("foo");
|
||||
const defaultOutput = `["foo", "foo", "foo", more...]`;
|
||||
const defaultOutput = `["foo", "foo", "foo", more…]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ window.onload = Task.async(function* () {
|
|||
},
|
||||
{
|
||||
mode: "long",
|
||||
expectedOutput: `[${Array(300).fill("\"foo\"").join(", ")}, more...]`,
|
||||
expectedOutput: `[${Array(300).fill("\"foo\"").join(", ")}, more…]`,
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -122,7 +122,7 @@ window.onload = Task.async(function* () {
|
|||
function testRecursiveArray() {
|
||||
let stub = [1];
|
||||
stub.push(stub);
|
||||
const defaultOutput = `[1, [...]]`;
|
||||
const defaultOutput = `[1, […]]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ window.onload = Task.async(function* () {
|
|||
p4: "s4"
|
||||
}
|
||||
];
|
||||
const defaultOutput = `[Object{p1: "s1", p3: "s3", p4: "s4", more...}]`;
|
||||
const defaultOutput = `[Object{p1: "s1", p3: "s3", p4: "s4", more…}]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
|
|
@ -96,10 +96,10 @@ window.onload = Task.async(function* () {
|
|||
}
|
||||
|
||||
function testMoreThanMaxProps() {
|
||||
// Test array = `["test string"...] //301 items`
|
||||
// Test array = `["test string"…] //301 items`
|
||||
const testName = "testMoreThanMaxProps";
|
||||
|
||||
const defaultOutput = `[${Array(3).fill("\"test string\"").join(", ")}, more...]`;
|
||||
const defaultOutput = `[${Array(3).fill("\"test string\"").join(", ")}, more…]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ window.onload = Task.async(function* () {
|
|||
},
|
||||
{
|
||||
mode: "long",
|
||||
expectedOutput: `[${Array(300).fill("\"test string\"").join(", ")}, more...]`,
|
||||
expectedOutput: `[${Array(300).fill("\"test string\"").join(", ")}, more…]`,
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -100,10 +100,10 @@ window.onload = Task.async(function* () {
|
|||
}
|
||||
|
||||
function testMoreThanMaxProps() {
|
||||
// Test object = `{p0: "0", p1: "1", p2: "2", ..., p101: "101"}`
|
||||
// Test object = `{p0: "0", p1: "1", p2: "2", …, p101: "101"}`
|
||||
const testName = "testMoreThanMaxProps";
|
||||
|
||||
const defaultOutput = `Object {p0: "0", p1: "1", p2: "2", more...}`;
|
||||
const defaultOutput = `Object {p0: "0", p1: "1", p2: "2", more…}`;
|
||||
|
||||
// Generate string with 100 properties, which is the max limit
|
||||
// for 'long' mode.
|
||||
|
@ -112,7 +112,7 @@ window.onload = Task.async(function* () {
|
|||
props += "p" + i + ": \"" + i + "\", ";
|
||||
}
|
||||
|
||||
const longOutput = `Object {${props}more...}`;
|
||||
const longOutput = `Object {${props}more…}`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ window.onload = Task.async(function* () {
|
|||
// Test object: `{a: undefined, b: undefined, c: "c", d: 1}`
|
||||
// @TODO This is not how we actually want the preview to be output.
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1276376
|
||||
const expectedOutput = `Object {a: undefined, b: undefined, c: "c", more...}`;
|
||||
const expectedOutput = `Object {a: undefined, b: undefined, c: "c", more…}`;
|
||||
}
|
||||
|
||||
function testNestedObject() {
|
||||
|
|
|
@ -101,7 +101,7 @@ window.onload = Task.async(function* () {
|
|||
for (let i = 0; i<100; i++) {
|
||||
stub[`p${i}`] = i
|
||||
}
|
||||
const defaultOutput = `Object{p0: 0, p1: 1, p2: 2, more...}`;
|
||||
const defaultOutput = `Object{p0: 0, p1: 1, p2: 2, more…}`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ window.onload = Task.async(function* () {
|
|||
|
||||
function testUninterestingProps() {
|
||||
const stub = {a:undefined, b:undefined, c:"c", d:0};
|
||||
const defaultOutput = `Object{c: "c", d: 0, a: undefined, more...}`;
|
||||
const defaultOutput = `Object{c: "c", d: 0, a: undefined, more…}`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
|
|
@ -122,6 +122,7 @@ skip-if = e10s # Bug 1221911, bug 1222289, frequent e10s timeouts
|
|||
[browser_html_tooltip_arrow-02.js]
|
||||
[browser_html_tooltip_consecutive-show.js]
|
||||
[browser_html_tooltip_offset.js]
|
||||
[browser_html_tooltip_rtl.js]
|
||||
[browser_html_tooltip_variable-height.js]
|
||||
[browser_html_tooltip_width-auto.js]
|
||||
[browser_html_tooltip_xul-wrapper.js]
|
||||
|
|
|
@ -46,6 +46,7 @@ function* runTests(doc) {
|
|||
yield testClickInTooltipContent(doc);
|
||||
yield testConsumeOutsideClicksFalse(doc);
|
||||
yield testConsumeOutsideClicksTrue(doc);
|
||||
yield testConsumeWithRightClick(doc);
|
||||
yield testClickInOuterIframe(doc);
|
||||
yield testClickInInnerIframe(doc);
|
||||
}
|
||||
|
@ -106,6 +107,28 @@ function* testConsumeOutsideClicksTrue(doc) {
|
|||
tooltip.destroy();
|
||||
}
|
||||
|
||||
function* testConsumeWithRightClick(doc) {
|
||||
info("Test closing a tooltip with a right-click, with consumeOutsideClicks: true");
|
||||
let box4 = doc.getElementById("box4");
|
||||
|
||||
let tooltip = new HTMLTooltip({doc}, {consumeOutsideClicks: true, useXulWrapper});
|
||||
tooltip.setContent(getTooltipContent(doc), {width: 100, height: 50});
|
||||
yield showTooltip(tooltip, doc.getElementById("box1"));
|
||||
|
||||
// Only left-click events should be consumed, so we expect to catch a click when using
|
||||
// {button: 2}, which simulates a right-click.
|
||||
info("Right click on box4, expect tooltip to be hidden, event should not be consumed");
|
||||
let onBox4Clicked = once(box4, "click");
|
||||
let onHidden = once(tooltip, "hidden");
|
||||
EventUtils.synthesizeMouseAtCenter(box4, {button: 2}, doc.defaultView);
|
||||
yield onHidden;
|
||||
yield onBox4Clicked;
|
||||
|
||||
is(tooltip.isVisible(), false, "Tooltip is hidden");
|
||||
|
||||
tooltip.destroy();
|
||||
}
|
||||
|
||||
function* testClickInOuterIframe(doc) {
|
||||
info("Test clicking an iframe outside of the tooltip closes the tooltip");
|
||||
let frame = doc.getElementById("frame");
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* import-globals-from helper_html_tooltip.js */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test the HTMLTooltip anchor alignment changes with the anchor direction.
|
||||
* - should be aligned to the right of RTL anchors
|
||||
* - should be aligned to the left of LTR anchors
|
||||
*/
|
||||
|
||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
const TEST_URI = `data:text/xml;charset=UTF-8,<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css"?>
|
||||
<?xml-stylesheet href="chrome://devtools/skin/tooltips.css"?>
|
||||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
htmlns="http://www.w3.org/1999/xhtml"
|
||||
title="Tooltip test">
|
||||
<hbox style="padding: 90px 0;" flex="1">
|
||||
<hbox id="box1" flex="1" style="background:red; direction: rtl;">test1</hbox>
|
||||
<hbox id="box2" flex="1" style="background:blue; direction: rtl;">test2</hbox>
|
||||
<hbox id="box3" flex="1" style="background:red; direction: ltr;">test3</hbox>
|
||||
<hbox id="box4" flex="1" style="background:blue; direction: ltr;">test4</hbox>
|
||||
</hbox>
|
||||
</window>`;
|
||||
|
||||
const {HTMLTooltip} = require("devtools/client/shared/widgets/HTMLTooltip");
|
||||
loadHelperScript("helper_html_tooltip.js");
|
||||
|
||||
const TOOLBOX_WIDTH = 500;
|
||||
const TOOLTIP_WIDTH = 150;
|
||||
const TOOLTIP_HEIGHT = 30;
|
||||
|
||||
add_task(function* () {
|
||||
// Force the toolbox to be 500px wide (min width is 465px);
|
||||
yield pushPref("devtools.toolbox.sidebar.width", TOOLBOX_WIDTH);
|
||||
|
||||
let [,, doc] = yield createHost("side", TEST_URI);
|
||||
|
||||
info("Test a tooltip is not closed when clicking inside itself");
|
||||
|
||||
let tooltip = new HTMLTooltip({doc}, {useXulWrapper: false});
|
||||
let div = doc.createElementNS(HTML_NS, "div");
|
||||
div.textContent = "tooltip";
|
||||
div.style.cssText = "box-sizing: border-box; border: 1px solid black";
|
||||
tooltip.setContent(div, {width: TOOLTIP_WIDTH, height: TOOLTIP_HEIGHT});
|
||||
|
||||
yield testRtlAnchors(doc, tooltip);
|
||||
yield testLtrAnchors(doc, tooltip);
|
||||
yield hideTooltip(tooltip);
|
||||
|
||||
tooltip.destroy();
|
||||
});
|
||||
|
||||
function* testRtlAnchors(doc, tooltip) {
|
||||
/*
|
||||
* The layout of the test page is as follows:
|
||||
* _______________________________
|
||||
* | toolbox |
|
||||
* | _____ _____ _____ _____ |
|
||||
* || | | | | | | ||
|
||||
* || box1| | box2| | box3| | box4||
|
||||
* ||_____| |_____| |_____| |_____||
|
||||
* |_______________________________|
|
||||
*
|
||||
* - box1 is aligned with the left edge of the toolbox
|
||||
* - box2 is displayed right after box1
|
||||
* - total toolbox width is 500px so each box is 125px wide
|
||||
*/
|
||||
|
||||
let box1 = doc.getElementById("box1");
|
||||
let box2 = doc.getElementById("box2");
|
||||
|
||||
info("Display the tooltip on box1.");
|
||||
yield showTooltip(tooltip, box1, {position: "bottom"});
|
||||
|
||||
let panelRect = tooltip.container.getBoundingClientRect();
|
||||
let anchorRect = box1.getBoundingClientRect();
|
||||
|
||||
// box1 uses RTL direction, so the tooltip should be aligned with the right edge of the
|
||||
// anchor, but it is shifted to the right to fit in the toolbox.
|
||||
is(panelRect.left, 0, "Tooltip is aligned with left edge of the toolbox");
|
||||
is(panelRect.top, anchorRect.bottom, "Tooltip aligned with the anchor bottom edge");
|
||||
is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected");
|
||||
|
||||
info("Display the tooltip on box2.");
|
||||
yield showTooltip(tooltip, box2, {position: "bottom"});
|
||||
|
||||
panelRect = tooltip.container.getBoundingClientRect();
|
||||
anchorRect = box2.getBoundingClientRect();
|
||||
|
||||
// box2 uses RTL direction, so the tooltip is aligned with the right edge of the anchor
|
||||
is(panelRect.right, anchorRect.right, "Tooltip is aligned with right edge of anchor");
|
||||
is(panelRect.top, anchorRect.bottom, "Tooltip aligned with the anchor bottom edge");
|
||||
is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected");
|
||||
}
|
||||
|
||||
function* testLtrAnchors(doc, tooltip) {
|
||||
/*
|
||||
* The layout of the test page is as follows:
|
||||
* _______________________________
|
||||
* | toolbox |
|
||||
* | _____ _____ _____ _____ |
|
||||
* || | | | | | | ||
|
||||
* || box1| | box2| | box3| | box4||
|
||||
* ||_____| |_____| |_____| |_____||
|
||||
* |_______________________________|
|
||||
*
|
||||
* - box3 is is displayed right after box2
|
||||
* - box4 is aligned with the right edge of the toolbox
|
||||
* - total toolbox width is 500px so each box is 125px wide
|
||||
*/
|
||||
|
||||
let box3 = doc.getElementById("box3");
|
||||
let box4 = doc.getElementById("box4");
|
||||
|
||||
info("Display the tooltip on box3.");
|
||||
yield showTooltip(tooltip, box3, {position: "bottom"});
|
||||
|
||||
let panelRect = tooltip.container.getBoundingClientRect();
|
||||
let anchorRect = box3.getBoundingClientRect();
|
||||
|
||||
// box3 uses LTR direction, so the tooltip is aligned with the left edge of the anchor.
|
||||
is(panelRect.left, anchorRect.left, "Tooltip is aligned with left edge of anchor");
|
||||
is(panelRect.top, anchorRect.bottom, "Tooltip aligned with the anchor bottom edge");
|
||||
is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected");
|
||||
|
||||
info("Display the tooltip on box4.");
|
||||
yield showTooltip(tooltip, box4, {position: "bottom"});
|
||||
|
||||
panelRect = tooltip.container.getBoundingClientRect();
|
||||
anchorRect = box4.getBoundingClientRect();
|
||||
|
||||
// box4 uses LTR direction, so the tooltip should be aligned with the left edge of the
|
||||
// anchor, but it is shifted to the left to fit in the toolbox.
|
||||
is(panelRect.right, TOOLBOX_WIDTH, "Tooltip is aligned with right edge of toolbox");
|
||||
is(panelRect.top, anchorRect.bottom, "Tooltip aligned with the anchor bottom edge");
|
||||
is(panelRect.height, TOOLTIP_HEIGHT, "Tooltip height is at 100px as expected");
|
||||
}
|
|
@ -114,17 +114,24 @@ function (anchorRect, viewportRect, height, pos, offset) {
|
|||
* space should not be used by tooltips (for instance OS toolbars, taskbars etc.).
|
||||
* @param {Number} width
|
||||
* Preferred width for the tooltip.
|
||||
* @param {String} type
|
||||
* The tooltip type (e.g. "arrow").
|
||||
* @param {Number} offset
|
||||
* Horizontal offset in pixels.
|
||||
* @param {Boolean} isRtl
|
||||
* If the anchor is in RTL, the tooltip should be aligned to the right.
|
||||
* @return {Object}
|
||||
* - {Number} left: the left offset for the tooltip.
|
||||
* - {Number} width: the width to use for the tooltip container.
|
||||
* - {Number} arrowLeft: the left offset to use for the arrow element.
|
||||
*/
|
||||
const calculateHorizontalPosition =
|
||||
function (anchorRect, viewportRect, width, type, offset) {
|
||||
let {left: anchorLeft, width: anchorWidth} = anchorRect;
|
||||
function (anchorRect, viewportRect, width, type, offset, isRtl) {
|
||||
let anchorWidth = anchorRect.width;
|
||||
let anchorStart = isRtl ? anchorRect.right : anchorRect.left;
|
||||
|
||||
// Translate to the available viewport space before calculating dimensions and position.
|
||||
anchorLeft -= viewportRect.left;
|
||||
anchorStart -= viewportRect.left;
|
||||
|
||||
// Calculate WIDTH.
|
||||
width = Math.min(width, viewportRect.width);
|
||||
|
@ -132,14 +139,16 @@ function (anchorRect, viewportRect, width, type, offset) {
|
|||
// Calculate LEFT.
|
||||
// By default the tooltip is aligned with the anchor left edge. Unless this
|
||||
// makes it overflow the viewport, in which case is shifts to the left.
|
||||
let left = Math.min(anchorLeft + offset, viewportRect.width - width);
|
||||
let left = anchorStart + offset - (isRtl ? width : 0);
|
||||
left = Math.min(left, viewportRect.width - width);
|
||||
left = Math.max(0, left);
|
||||
|
||||
// Calculate ARROW LEFT (tooltip's LEFT might be updated)
|
||||
let arrowLeft;
|
||||
// Arrow style tooltips may need to be shifted to the left
|
||||
if (type === TYPE.ARROW) {
|
||||
let arrowCenter = left + ARROW_OFFSET + ARROW_WIDTH / 2;
|
||||
let anchorCenter = anchorLeft + anchorWidth / 2;
|
||||
let anchorCenter = anchorStart + anchorWidth / 2;
|
||||
// If the anchor is too narrow, align the arrow and the anchor center.
|
||||
if (arrowCenter > anchorCenter) {
|
||||
left = Math.max(0, left - (arrowCenter - anchorCenter));
|
||||
|
@ -147,7 +156,7 @@ function (anchorRect, viewportRect, width, type, offset) {
|
|||
// Arrow's left offset relative to the anchor.
|
||||
arrowLeft = Math.min(ARROW_OFFSET, (anchorWidth - ARROW_WIDTH) / 2) | 0;
|
||||
// Translate the coordinate to tooltip container
|
||||
arrowLeft += anchorLeft - left;
|
||||
arrowLeft += anchorStart - left;
|
||||
// Make sure the arrow remains in the tooltip container.
|
||||
arrowLeft = Math.min(arrowLeft, width - ARROW_WIDTH);
|
||||
arrowLeft = Math.max(arrowLeft, 0);
|
||||
|
@ -347,8 +356,10 @@ HTMLTooltip.prototype = {
|
|||
preferredWidth = this.preferredWidth + themeWidth;
|
||||
}
|
||||
|
||||
let {left, width, arrowLeft} =
|
||||
calculateHorizontalPosition(anchorRect, viewportRect, preferredWidth, this.type, x);
|
||||
let anchorWin = anchor.ownerDocument.defaultView;
|
||||
let isRtl = anchorWin.getComputedStyle(anchor).direction === "rtl";
|
||||
let {left, width, arrowLeft} = calculateHorizontalPosition(
|
||||
anchorRect, viewportRect, preferredWidth, this.type, x, isRtl);
|
||||
|
||||
this.container.style.width = width + "px";
|
||||
|
||||
|
@ -491,7 +502,8 @@ HTMLTooltip.prototype = {
|
|||
}
|
||||
|
||||
this.hide();
|
||||
if (this.consumeOutsideClicks) {
|
||||
if (this.consumeOutsideClicks && e.button === 0) {
|
||||
// Consume only left click events (button === 0).
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
|
|
@ -68,15 +68,13 @@
|
|||
padding: 2px;
|
||||
}
|
||||
|
||||
.devtools-autocomplete-listbox > scrollbox {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.devtools-autocomplete-listbox .autocomplete-item {
|
||||
width: 100%;
|
||||
background-color: transparent;
|
||||
border-radius: 4px;
|
||||
padding: 1px 0;
|
||||
/* Force text-align even in RTL locales to ensure a correct display of the popup */
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.devtools-autocomplete-listbox .autocomplete-selected {
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.mozilla.gecko.TelemetryContract;
|
|||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.RemoteClient;
|
||||
import org.mozilla.gecko.restrictions.Restrictable;
|
||||
import org.mozilla.gecko.widget.DividerItemDecoration;
|
||||
import org.mozilla.gecko.widget.HistoryDividerItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -171,7 +171,7 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
|
|||
animator.setRemoveDuration(100);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
|
||||
mRecyclerView.addItemDecoration(new HistoryDividerItemDecoration(getContext()));
|
||||
mRecyclerView.setOnHistoryClickedListener(mUrlOpenListener);
|
||||
mRecyclerView.setOnPanelLevelChangeListener(new OnLevelChangeListener());
|
||||
mRecyclerView.setHiddenClientsDialogBuilder(new HiddenClientsHelper());
|
||||
|
|
|
@ -8,12 +8,13 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.home.CombinedHistoryItem;
|
||||
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
public class HistoryDividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private final int mDividerHeight;
|
||||
private final Paint mDividerPaint;
|
||||
|
||||
public DividerItemDecoration(Context context) {
|
||||
public HistoryDividerItemDecoration(Context context) {
|
||||
mDividerHeight = (int) context.getResources().getDimension(R.dimen.page_row_divider_height);
|
||||
|
||||
mDividerPaint = new Paint();
|
||||
|
@ -23,7 +24,11 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.set(0, 0, 0, mDividerHeight);
|
||||
final int position = parent.getChildAdapterPosition(view);
|
||||
if (parent.getAdapter().getItemViewType(position) !=
|
||||
CombinedHistoryItem.ItemType.itemTypeToViewType(CombinedHistoryItem.ItemType.SECTION_HEADER)) {
|
||||
outRect.set(0, 0, 0, mDividerHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,8 +38,12 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
}
|
||||
for (int i = 0; i < parent.getChildCount(); i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
final float bottom = child.getBottom() + child.getTranslationY();
|
||||
c.drawRect(0, bottom, parent.getWidth(), bottom + mDividerHeight, mDividerPaint);
|
||||
final int position = parent.getChildAdapterPosition(child);
|
||||
if (parent.getAdapter().getItemViewType(position) !=
|
||||
CombinedHistoryItem.ItemType.itemTypeToViewType(CombinedHistoryItem.ItemType.SECTION_HEADER)) {
|
||||
final float bottom = child.getBottom() + child.getTranslationY();
|
||||
c.drawRect(0, bottom, parent.getWidth(), bottom + mDividerHeight, mDividerPaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -651,7 +651,6 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'widget/CropImageView.java',
|
||||
'widget/DateTimePicker.java',
|
||||
'widget/DefaultDoorHanger.java',
|
||||
'widget/DividerItemDecoration.java',
|
||||
'widget/DoorHanger.java',
|
||||
'widget/DoorhangerConfig.java',
|
||||
'widget/EllipsisTextView.java',
|
||||
|
@ -663,6 +662,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'widget/FlowLayout.java',
|
||||
'widget/GeckoActionProvider.java',
|
||||
'widget/GeckoPopupMenu.java',
|
||||
'widget/HistoryDividerItemDecoration.java',
|
||||
'widget/IconTabWidget.java',
|
||||
'widget/LoginDoorHanger.java',
|
||||
'widget/RecyclerViewClickSupport.java',
|
||||
|
|
|
@ -229,13 +229,16 @@
|
|||
|
||||
<style name="Widget.Home.HeaderItem">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">32dp</item>
|
||||
<item name="android:layout_height">36dp</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance.Widget.Home.Header</item>
|
||||
<item name="android:background">@color/about_page_header_grey</item>
|
||||
<item name="android:background">@android:color/white</item>
|
||||
<item name="android:focusable">false</item>
|
||||
<item name="android:gravity">center|left</item>
|
||||
<item name="android:paddingLeft">10dip</item>
|
||||
<item name="android:paddingRight">10dip</item>
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:paddingTop">11dp</item>
|
||||
<item name="android:paddingBottom">11dp</item>
|
||||
<item name="android:includeFontPadding">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Home.ActionButton">
|
||||
|
@ -384,7 +387,8 @@
|
|||
<style name="TextAppearance.Widget.Home" />
|
||||
|
||||
<style name="TextAppearance.Widget.Home.Header" parent="TextAppearance.Small">
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textColor">@color/disabled_grey</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Widget.Home.ItemTitle" parent="TextAppearance">
|
||||
|
|
|
@ -383,6 +383,7 @@ ClientEngine.prototype = {
|
|||
if (!commands) {
|
||||
return true;
|
||||
}
|
||||
let URIsToDisplay = [];
|
||||
for (let key in commands) {
|
||||
let {command, args} = commands[key];
|
||||
this._log.debug("Processing command: " + command + "(" + args + ")");
|
||||
|
@ -405,13 +406,17 @@ ClientEngine.prototype = {
|
|||
this.service.logout();
|
||||
return false;
|
||||
case "displayURI":
|
||||
this._handleDisplayURI.apply(this, args);
|
||||
let [uri, clientId, title] = args;
|
||||
URIsToDisplay.push({ uri, clientId, title });
|
||||
break;
|
||||
default:
|
||||
this._log.debug("Received an unknown command: " + command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (URIsToDisplay.length) {
|
||||
this._handleDisplayURIs(URIsToDisplay);
|
||||
}
|
||||
|
||||
return true;
|
||||
})();
|
||||
|
@ -481,11 +486,11 @@ ClientEngine.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Handle a single received 'displayURI' command.
|
||||
* Handle a bunch of received 'displayURI' commands.
|
||||
*
|
||||
* Interested parties should observe the "weave:engine:clients:display-uri"
|
||||
* topic. The callback will receive an object as the subject parameter with
|
||||
* the following keys:
|
||||
* Interested parties should observe the "weave:engine:clients:display-uris"
|
||||
* topic. The callback will receive an array as the subject parameter
|
||||
* containing objects with the following keys:
|
||||
*
|
||||
* uri URI (string) that is requested for display.
|
||||
* clientId ID of client that sent the command.
|
||||
|
@ -493,20 +498,18 @@ ClientEngine.prototype = {
|
|||
*
|
||||
* The 'data' parameter to the callback will not be defined.
|
||||
*
|
||||
* @param uri
|
||||
* @param uris
|
||||
* An array containing URI objects to display
|
||||
* @param uris[].uri
|
||||
* String URI that was received
|
||||
* @param clientId
|
||||
* @param uris[].clientId
|
||||
* ID of client that sent URI
|
||||
* @param title
|
||||
* @param uris[].title
|
||||
* String title of page that URI corresponds to. Older clients may not
|
||||
* send this.
|
||||
*/
|
||||
_handleDisplayURI: function _handleDisplayURI(uri, clientId, title) {
|
||||
this._log.info("Received a URI for display: " + uri + " (" + title +
|
||||
") from " + clientId);
|
||||
|
||||
let subject = {uri: uri, client: clientId, title: title};
|
||||
Svc.Obs.notify("weave:engine:clients:display-uri", subject);
|
||||
_handleDisplayURIs: function _handleDisplayURIs(uris) {
|
||||
Svc.Obs.notify("weave:engine:clients:display-uris", uris);
|
||||
},
|
||||
|
||||
_removeRemoteClient(id) {
|
||||
|
|
|
@ -766,14 +766,14 @@ add_test(function test_receive_display_uri() {
|
|||
|
||||
// Received 'displayURI' command should result in the topic defined below
|
||||
// being called.
|
||||
let ev = "weave:engine:clients:display-uri";
|
||||
let ev = "weave:engine:clients:display-uris";
|
||||
|
||||
let handler = function(subject, data) {
|
||||
Svc.Obs.remove(ev, handler);
|
||||
|
||||
do_check_eq(subject.uri, uri);
|
||||
do_check_eq(subject.client, remoteId);
|
||||
do_check_eq(subject.title, title);
|
||||
do_check_eq(subject[0].uri, uri);
|
||||
do_check_eq(subject[0].clientId, remoteId);
|
||||
do_check_eq(subject[0].title, title);
|
||||
do_check_eq(data, null);
|
||||
|
||||
run_next_test();
|
||||
|
|
Загрузка…
Ссылка в новой задаче