зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central r=merge a=merge
This commit is contained in:
Коммит
da0a72a9d7
12
.cron.yml
12
.cron.yml
|
@ -98,6 +98,18 @@ jobs:
|
||||||
mozilla-central: [{hour: 10, minute: 0}]
|
mozilla-central: [{hour: 10, minute: 0}]
|
||||||
# No default
|
# No default
|
||||||
|
|
||||||
|
- name: searchfox-index
|
||||||
|
job:
|
||||||
|
type: decision-task
|
||||||
|
treeherder-symbol: Searchfox
|
||||||
|
target-tasks-method: searchfox_index
|
||||||
|
run-on-projects:
|
||||||
|
- mozilla-central
|
||||||
|
when:
|
||||||
|
by-project:
|
||||||
|
mozilla-central: [{hour: 10, minute: 30}]
|
||||||
|
# No default
|
||||||
|
|
||||||
- name: periodic-update
|
- name: periodic-update
|
||||||
job:
|
job:
|
||||||
type: decision-task
|
type: decision-task
|
||||||
|
|
|
@ -20,7 +20,7 @@ var BrowserPageActions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The photonmultiview node in the main page action panel (DOM node)
|
* The panelmultiview node in the main page action panel (DOM node)
|
||||||
*/
|
*/
|
||||||
get multiViewNode() {
|
get multiViewNode() {
|
||||||
delete this.multiViewNode;
|
delete this.multiViewNode;
|
||||||
|
@ -234,7 +234,7 @@ var BrowserPageActions = {
|
||||||
let iframeNode = null;
|
let iframeNode = null;
|
||||||
|
|
||||||
if (action.subview) {
|
if (action.subview) {
|
||||||
let multiViewNode = document.createElement("photonpanelmultiview");
|
let multiViewNode = document.createElement("panelmultiview");
|
||||||
panelViewNode = this._makePanelViewNodeForAction(action, true);
|
panelViewNode = this._makePanelViewNodeForAction(action, true);
|
||||||
multiViewNode.appendChild(panelViewNode);
|
multiViewNode.appendChild(panelViewNode);
|
||||||
panelNode.appendChild(multiViewNode);
|
panelNode.appendChild(multiViewNode);
|
||||||
|
|
|
@ -71,32 +71,17 @@ panelmultiview {
|
||||||
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#panelmultiview");
|
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#panelmultiview");
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview {
|
|
||||||
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#photonpanelmultiview");
|
|
||||||
}
|
|
||||||
|
|
||||||
panelview {
|
panelview {
|
||||||
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#panelview");
|
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#panelview");
|
||||||
-moz-box-orient: vertical;
|
-moz-box-orient: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
panel[hidden] panelmultiview,
|
panel[hidden] panelmultiview,
|
||||||
panel[hidden] photonpanelmultiview,
|
|
||||||
panel[hidden] panelview {
|
panel[hidden] panelview {
|
||||||
-moz-binding: none;
|
-moz-binding: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-mainview {
|
panelview:not([current]):not([in-transition]) {
|
||||||
transition: transform var(--panelui-subview-transition-duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
panelview:not([mainview]):not([current]):not([in-transition]) {
|
|
||||||
transition: visibility 0s linear var(--panelui-subview-transition-duration);
|
|
||||||
visibility: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
photonpanelmultiview panelview:not([current]):not([in-transition]) {
|
|
||||||
transition: none;
|
|
||||||
visibility: collapse;
|
visibility: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,12 +1055,6 @@ notification[value="translation"] {
|
||||||
-moz-binding: url("chrome://browser/content/translation-infobar.xml#translationbar");
|
-moz-binding: url("chrome://browser/content/translation-infobar.xml#translationbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** See bug 872317 for why the following rule is necessary. */
|
|
||||||
|
|
||||||
#downloads-button {
|
|
||||||
-moz-binding: url("chrome://browser/content/downloads/download.xml#download-toolbarbutton");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Visibility of downloads indicator controls ***/
|
/*** Visibility of downloads indicator controls ***/
|
||||||
|
|
||||||
/* Bug 924050: If we've loaded the indicator, for now we hide it in the menu panel,
|
/* Bug 924050: If we've loaded the indicator, for now we hide it in the menu panel,
|
||||||
|
|
|
@ -417,15 +417,15 @@
|
||||||
emailLink-title="&emailPageCmd.label;"
|
emailLink-title="&emailPageCmd.label;"
|
||||||
sendToDevice-title="&pageAction.sendTabToDevice.label;"
|
sendToDevice-title="&pageAction.sendTabToDevice.label;"
|
||||||
sendToDevice-notReadyTitle="&sendToDevice.syncNotReady.label;">
|
sendToDevice-notReadyTitle="&sendToDevice.syncNotReady.label;">
|
||||||
<photonpanelmultiview id="pageActionPanelMultiView"
|
<panelmultiview id="pageActionPanelMultiView"
|
||||||
mainViewId="pageActionPanelMainView"
|
mainViewId="pageActionPanelMainView"
|
||||||
viewCacheId="appMenu-viewCache">
|
viewCacheId="appMenu-viewCache">
|
||||||
<panelview id="pageActionPanelMainView"
|
<panelview id="pageActionPanelMainView"
|
||||||
context="pageActionContextMenu"
|
context="pageActionContextMenu"
|
||||||
class="PanelUI-subView">
|
class="PanelUI-subView">
|
||||||
<vbox class="panel-subview-body"/>
|
<vbox class="panel-subview-body"/>
|
||||||
</panelview>
|
</panelview>
|
||||||
</photonpanelmultiview>
|
</panelmultiview>
|
||||||
</panel>
|
</panel>
|
||||||
<panel id="pageActionFeedback"
|
<panel id="pageActionFeedback"
|
||||||
role="alert"
|
role="alert"
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
<broadcaster id="identity-popup-insecure-login-forms-learn-more" class="text-link plain" value="&identity.learnMore;"/>
|
<broadcaster id="identity-popup-insecure-login-forms-learn-more" class="text-link plain" value="&identity.learnMore;"/>
|
||||||
</broadcasterset>
|
</broadcasterset>
|
||||||
|
|
||||||
<photonpanelmultiview id="identity-popup-multiView"
|
<panelmultiview id="identity-popup-multiView"
|
||||||
mainViewId="identity-popup-mainView">
|
mainViewId="identity-popup-mainView">
|
||||||
<panelview id="identity-popup-mainView"
|
<panelview id="identity-popup-mainView"
|
||||||
descriptionheightworkaround="true">
|
descriptionheightworkaround="true">
|
||||||
<!-- Security Section -->
|
<!-- Security Section -->
|
||||||
|
@ -184,5 +184,5 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
</panelview>
|
</panelview>
|
||||||
</photonpanelmultiview>
|
</panelmultiview>
|
||||||
</panel>
|
</panel>
|
||||||
|
|
|
@ -1620,7 +1620,7 @@ var CustomizableUIInternal = {
|
||||||
if (areaType != CustomizableUI.TYPE_MENU_PANEL) {
|
if (areaType != CustomizableUI.TYPE_MENU_PANEL) {
|
||||||
let wrapper = this.wrapWidget(aWidget.id).forWindow(ownerWindow);
|
let wrapper = this.wrapWidget(aWidget.id).forWindow(ownerWindow);
|
||||||
|
|
||||||
let hasMultiView = !!aNode.closest("photonpanelmultiview,panelmultiview");
|
let hasMultiView = !!aNode.closest("panelmultiview");
|
||||||
if (wrapper && !hasMultiView && wrapper.anchor) {
|
if (wrapper && !hasMultiView && wrapper.anchor) {
|
||||||
this.hidePanelForNode(aNode);
|
this.hidePanelForNode(aNode);
|
||||||
anchor = wrapper.anchor;
|
anchor = wrapper.anchor;
|
||||||
|
@ -1804,13 +1804,9 @@ var CustomizableUIInternal = {
|
||||||
|
|
||||||
if (closemenu == "single") {
|
if (closemenu == "single") {
|
||||||
let panel = this._getPanelForNode(target);
|
let panel = this._getPanelForNode(target);
|
||||||
let multiview = panel.querySelector("photonpanelmultiview,panelmultiview");
|
let multiview = panel.querySelector("panelmultiview");
|
||||||
if (multiview.showingSubView) {
|
if (multiview.showingSubView) {
|
||||||
if (multiview.instance.panelViews) {
|
multiview.goBack();
|
||||||
multiview.goBack();
|
|
||||||
} else {
|
|
||||||
multiview.showMainView();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4303,15 +4299,10 @@ OverflowableToolbar.prototype = {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let doc = this._panel.ownerDocument;
|
let doc = this._panel.ownerDocument;
|
||||||
this._panel.hidden = false;
|
this._panel.hidden = false;
|
||||||
let photonView = this._panel.querySelector("photonpanelmultiview");
|
let multiview = this._panel.querySelector("panelmultiview");
|
||||||
let contextMenu;
|
let mainViewId = multiview.getAttribute("mainViewId");
|
||||||
if (photonView) {
|
let mainView = doc.getElementById(mainViewId);
|
||||||
let mainViewId = photonView.getAttribute("mainViewId");
|
let contextMenu = doc.getElementById(mainView.getAttribute("context"));
|
||||||
let mainView = doc.getElementById(mainViewId);
|
|
||||||
contextMenu = doc.getElementById(mainView.getAttribute("context"));
|
|
||||||
} else {
|
|
||||||
contextMenu = doc.getElementById(this._panel.getAttribute("context"));
|
|
||||||
}
|
|
||||||
gELS.addSystemEventListener(contextMenu, "command", this, true);
|
gELS.addSystemEventListener(contextMenu, "command", this, true);
|
||||||
let anchor = doc.getAnonymousElementByAttribute(this._chevron, "class", "toolbarbutton-icon");
|
let anchor = doc.getAnonymousElementByAttribute(this._chevron, "class", "toolbarbutton-icon");
|
||||||
// Ensure we update the gEditUIVisible flag when opening the popup, in
|
// Ensure we update the gEditUIVisible flag when opening the popup, in
|
||||||
|
|
|
@ -166,7 +166,7 @@ this.PanelMultiView = class {
|
||||||
}
|
}
|
||||||
|
|
||||||
get showingSubView() {
|
get showingSubView() {
|
||||||
return this.node.getAttribute("viewtype") == "subview";
|
return this._showingSubView;
|
||||||
}
|
}
|
||||||
get _mainViewId() {
|
get _mainViewId() {
|
||||||
return this.node.getAttribute("mainViewId");
|
return this.node.getAttribute("mainViewId");
|
||||||
|
@ -201,11 +201,6 @@ this.PanelMultiView = class {
|
||||||
}
|
}
|
||||||
|
|
||||||
get panelViews() {
|
get panelViews() {
|
||||||
// If there's a dedicated subViews container, we're not in the right binding
|
|
||||||
// to use SlidingPanelViews.
|
|
||||||
if (this._subViews)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (this._panelViews)
|
if (this._panelViews)
|
||||||
return this._panelViews;
|
return this._panelViews;
|
||||||
|
|
||||||
|
@ -234,14 +229,10 @@ this.PanelMultiView = class {
|
||||||
return this._viewShowing || this._currentSubView;
|
return this._viewShowing || this._currentSubView;
|
||||||
}
|
}
|
||||||
get _currentSubView() {
|
get _currentSubView() {
|
||||||
return this.panelViews ? this.panelViews.currentView : this.__currentSubView;
|
return this.panelViews.currentView;
|
||||||
}
|
}
|
||||||
set _currentSubView(panel) {
|
set _currentSubView(panel) {
|
||||||
if (this.panelViews)
|
this.panelViews.currentView = panel;
|
||||||
this.panelViews.currentView = panel;
|
|
||||||
else
|
|
||||||
this.__currentSubView = panel;
|
|
||||||
return panel;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return {Promise} showSubView() returns a promise, which is kept here for
|
* @return {Promise} showSubView() returns a promise, which is kept here for
|
||||||
|
@ -268,20 +259,14 @@ this.PanelMultiView = class {
|
||||||
if (testMode)
|
if (testMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._currentSubView = this._anchorElement = this._subViewObserver = null;
|
this._currentSubView = this._subViewObserver = null;
|
||||||
this._mainViewHeight = 0;
|
this._mainViewHeight = 0;
|
||||||
this.__transitioning = this._ignoreMutations = false;
|
this.__transitioning = this._ignoreMutations = this._showingSubView = false;
|
||||||
|
|
||||||
const {document, window} = this;
|
const {document, window} = this;
|
||||||
|
|
||||||
this._clickCapturer =
|
|
||||||
document.getAnonymousElementByAttribute(this.node, "anonid", "clickCapturer");
|
|
||||||
this._viewContainer =
|
this._viewContainer =
|
||||||
document.getAnonymousElementByAttribute(this.node, "anonid", "viewContainer");
|
document.getAnonymousElementByAttribute(this.node, "anonid", "viewContainer");
|
||||||
this._mainViewContainer =
|
|
||||||
document.getAnonymousElementByAttribute(this.node, "anonid", "mainViewContainer");
|
|
||||||
this._subViews =
|
|
||||||
document.getAnonymousElementByAttribute(this.node, "anonid", "subViews");
|
|
||||||
this._viewStack =
|
this._viewStack =
|
||||||
document.getAnonymousElementByAttribute(this.node, "anonid", "viewStack");
|
document.getAnonymousElementByAttribute(this.node, "anonid", "viewStack");
|
||||||
this._offscreenViewStack =
|
this._offscreenViewStack =
|
||||||
|
@ -296,24 +281,14 @@ this.PanelMultiView = class {
|
||||||
this._panel.addEventListener("popuppositioned", this);
|
this._panel.addEventListener("popuppositioned", this);
|
||||||
this._panel.addEventListener("popuphidden", this);
|
this._panel.addEventListener("popuphidden", this);
|
||||||
this._panel.addEventListener("popupshown", this);
|
this._panel.addEventListener("popupshown", this);
|
||||||
if (this.panelViews) {
|
let cs = window.getComputedStyle(document.documentElement);
|
||||||
let cs = window.getComputedStyle(document.documentElement);
|
// Set CSS-determined attributes now to prevent a layout flush when we do
|
||||||
// Set CSS-determined attributes now to prevent a layout flush when we do
|
// it when transitioning between panels.
|
||||||
// it when transitioning between panels.
|
this._dir = cs.direction;
|
||||||
this._dir = cs.direction;
|
this.setMainView(this.panelViews.currentView);
|
||||||
this.setMainView(this.panelViews.currentView);
|
this.showMainView();
|
||||||
this.showMainView();
|
|
||||||
} else {
|
|
||||||
this._clickCapturer.addEventListener("click", this);
|
|
||||||
|
|
||||||
this._mainViewContainer.setAttribute("panelid", this._panel.id);
|
this._showingSubView = false;
|
||||||
|
|
||||||
if (this._mainView) {
|
|
||||||
this.setMainView(this._mainView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.node.setAttribute("viewtype", "main");
|
|
||||||
|
|
||||||
// Proxy these public properties and methods, as used elsewhere by various
|
// Proxy these public properties and methods, as used elsewhere by various
|
||||||
// parts of the browser, to this instance.
|
// parts of the browser, to this instance.
|
||||||
|
@ -354,24 +329,17 @@ this.PanelMultiView = class {
|
||||||
this._panelViewCache.appendChild(mainView);
|
this._panelViewCache.appendChild(mainView);
|
||||||
mainView.removeAttribute("mainview");
|
mainView.removeAttribute("mainview");
|
||||||
}
|
}
|
||||||
if (this._subViews)
|
|
||||||
this._moveOutKids(this._subViews);
|
|
||||||
|
|
||||||
if (this.panelViews) {
|
this._moveOutKids(this._viewStack);
|
||||||
this._moveOutKids(this._viewStack);
|
this.panelViews.clear();
|
||||||
this.panelViews.clear();
|
|
||||||
} else {
|
|
||||||
this._clickCapturer.removeEventListener("click", this);
|
|
||||||
}
|
|
||||||
this._panel.removeEventListener("mousemove", this);
|
this._panel.removeEventListener("mousemove", this);
|
||||||
this._panel.removeEventListener("popupshowing", this);
|
this._panel.removeEventListener("popupshowing", this);
|
||||||
this._panel.removeEventListener("popuppositioned", this);
|
this._panel.removeEventListener("popuppositioned", this);
|
||||||
this._panel.removeEventListener("popupshown", this);
|
this._panel.removeEventListener("popupshown", this);
|
||||||
this._panel.removeEventListener("popuphidden", this);
|
this._panel.removeEventListener("popuphidden", this);
|
||||||
this.window.removeEventListener("keydown", this);
|
this.window.removeEventListener("keydown", this);
|
||||||
this.node = this._clickCapturer = this._viewContainer = this._mainViewContainer =
|
this.node = this._viewContainer = this._viewStack = this.__dwu =
|
||||||
this._subViews = this._viewStack = this.__dwu = this._panelViewCache =
|
this._panelViewCache = this._transitionDetails = null;
|
||||||
this._transitionDetails = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -395,13 +363,9 @@ this.PanelMultiView = class {
|
||||||
}
|
}
|
||||||
|
|
||||||
_placeSubView(viewNode) {
|
_placeSubView(viewNode) {
|
||||||
if (this.panelViews) {
|
this._viewStack.appendChild(viewNode);
|
||||||
this._viewStack.appendChild(viewNode);
|
if (!this.panelViews.includes(viewNode))
|
||||||
if (!this.panelViews.includes(viewNode))
|
this.panelViews.push(viewNode);
|
||||||
this.panelViews.push(viewNode);
|
|
||||||
} else {
|
|
||||||
this._subViews.appendChild(viewNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goBack(target) {
|
goBack(target) {
|
||||||
|
@ -425,20 +389,15 @@ this.PanelMultiView = class {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._mainView) {
|
if (this._mainView) {
|
||||||
if (!this.panelViews)
|
|
||||||
this._subViews.appendChild(this._mainView);
|
|
||||||
this._mainView.removeAttribute("mainview");
|
this._mainView.removeAttribute("mainview");
|
||||||
}
|
}
|
||||||
this._mainViewId = aNewMainView.id;
|
this._mainViewId = aNewMainView.id;
|
||||||
aNewMainView.setAttribute("mainview", "true");
|
aNewMainView.setAttribute("mainview", "true");
|
||||||
if (this.panelViews) {
|
// If the new main view is not yet in the zeroth position, make sure it's
|
||||||
// If the new main view is not yet in the zeroth position, make sure it's
|
// inserted there.
|
||||||
// inserted there.
|
if (aNewMainView.parentNode != this._viewStack &&
|
||||||
if (aNewMainView.parentNode != this._viewStack && this._viewStack.firstChild != aNewMainView) {
|
this._viewStack.firstChild != aNewMainView) {
|
||||||
this._viewStack.insertBefore(aNewMainView, this._viewStack.firstChild);
|
this._viewStack.insertBefore(aNewMainView, this._viewStack.firstChild);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this._mainViewContainer.appendChild(aNewMainView);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,21 +405,7 @@ this.PanelMultiView = class {
|
||||||
if (!this._mainViewId)
|
if (!this._mainViewId)
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
||||||
if (this.panelViews)
|
return this.showSubView(this._mainView);
|
||||||
return this.showSubView(this._mainView);
|
|
||||||
|
|
||||||
if (this.showingSubView) {
|
|
||||||
let viewNode = this._currentSubView;
|
|
||||||
this._dispatchViewEvent(viewNode, "ViewHiding");
|
|
||||||
this._transitionHeight(() => {
|
|
||||||
viewNode.removeAttribute("current");
|
|
||||||
this._currentSubView = null;
|
|
||||||
this.node.setAttribute("viewtype", "main");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this._shiftMainView();
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -491,7 +436,7 @@ this.PanelMultiView = class {
|
||||||
this.descriptionHeightWorkaround(theOne);
|
this.descriptionHeightWorkaround(theOne);
|
||||||
this._dispatchViewEvent(theOne, "ViewShown");
|
this._dispatchViewEvent(theOne, "ViewShown");
|
||||||
}
|
}
|
||||||
this.node.setAttribute("viewtype", (theOne.id == this._mainViewId) ? "main" : "subview");
|
this._showingSubView = theOne.id != this._mainViewId;
|
||||||
}
|
}
|
||||||
|
|
||||||
showSubView(aViewId, aAnchor, aPreviousView) {
|
showSubView(aViewId, aAnchor, aPreviousView) {
|
||||||
|
@ -517,26 +462,21 @@ this.PanelMultiView = class {
|
||||||
let playTransition = (!!previousViewNode && !showingSameView && this._panel.state == "open");
|
let playTransition = (!!previousViewNode && !showingSameView && this._panel.state == "open");
|
||||||
let isMainView = viewNode.id == this._mainViewId;
|
let isMainView = viewNode.id == this._mainViewId;
|
||||||
|
|
||||||
let dwu, previousRect;
|
let dwu = this._dwu;
|
||||||
if (playTransition || this.panelViews) {
|
let previousRect = previousViewNode.__lastKnownBoundingRect =
|
||||||
dwu = this._dwu;
|
|
||||||
previousRect = previousViewNode.__lastKnownBoundingRect =
|
|
||||||
dwu.getBoundsWithoutFlushing(previousViewNode);
|
dwu.getBoundsWithoutFlushing(previousViewNode);
|
||||||
if (this.panelViews) {
|
// Cache the measures that have the same caching lifetime as the width
|
||||||
// Cache the measures that have the same caching lifetime as the width
|
// or height of the main view, i.e. whilst the panel is shown and/ or
|
||||||
// or height of the main view, i.e. whilst the panel is shown and/ or
|
// visible.
|
||||||
// visible.
|
if (!this._mainViewWidth) {
|
||||||
if (!this._mainViewWidth) {
|
this._mainViewWidth = previousRect.width;
|
||||||
this._mainViewWidth = previousRect.width;
|
let top = dwu.getBoundsWithoutFlushing(previousViewNode.firstChild || previousViewNode).top;
|
||||||
let top = dwu.getBoundsWithoutFlushing(previousViewNode.firstChild || previousViewNode).top;
|
let bottom = dwu.getBoundsWithoutFlushing(previousViewNode.lastChild || previousViewNode).bottom;
|
||||||
let bottom = dwu.getBoundsWithoutFlushing(previousViewNode.lastChild || previousViewNode).bottom;
|
this._viewVerticalPadding = previousRect.height - (bottom - top);
|
||||||
this._viewVerticalPadding = previousRect.height - (bottom - top);
|
}
|
||||||
}
|
if (!this._mainViewHeight) {
|
||||||
if (!this._mainViewHeight) {
|
this._mainViewHeight = previousRect.height;
|
||||||
this._mainViewHeight = previousRect.height;
|
this._viewContainer.style.minHeight = this._mainViewHeight + "px";
|
||||||
this._viewContainer.style.minHeight = this._mainViewHeight + "px";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._viewShowing = viewNode;
|
this._viewShowing = viewNode;
|
||||||
|
@ -549,12 +489,12 @@ this.PanelMultiView = class {
|
||||||
viewNode.removeAttribute("mainview");
|
viewNode.removeAttribute("mainview");
|
||||||
|
|
||||||
// Make sure that new panels always have a title set.
|
// Make sure that new panels always have a title set.
|
||||||
if (this.panelViews && aAnchor) {
|
if (aAnchor) {
|
||||||
if (!viewNode.hasAttribute("title"))
|
if (!viewNode.hasAttribute("title"))
|
||||||
viewNode.setAttribute("title", aAnchor.getAttribute("label"));
|
viewNode.setAttribute("title", aAnchor.getAttribute("label"));
|
||||||
viewNode.classList.add("PanelUI-subView");
|
viewNode.classList.add("PanelUI-subView");
|
||||||
}
|
}
|
||||||
if (this.panelViews && !isMainView && this._mainViewWidth)
|
if (!isMainView && this._mainViewWidth)
|
||||||
viewNode.style.maxWidth = viewNode.style.minWidth = this._mainViewWidth + "px";
|
viewNode.style.maxWidth = viewNode.style.minWidth = this._mainViewWidth + "px";
|
||||||
|
|
||||||
if (!showingSameView || !viewNode.hasAttribute("current")) {
|
if (!showingSameView || !viewNode.hasAttribute("current")) {
|
||||||
|
@ -584,31 +524,14 @@ this.PanelMultiView = class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we have to transition the panel.
|
// Now we have to transition the panel. If we've got an older transition
|
||||||
if (this.panelViews) {
|
// still running, make sure to clean it up.
|
||||||
// If we've got an older transition still running, make sure to clean it up.
|
await this._cleanupTransitionPhase();
|
||||||
await this._cleanupTransitionPhase();
|
if (playTransition) {
|
||||||
if (playTransition) {
|
await this._transitionViews(previousViewNode, viewNode, reverse, previousRect, aAnchor);
|
||||||
await this._transitionViews(previousViewNode, viewNode, reverse, previousRect, aAnchor);
|
this._updateKeyboardFocus(viewNode);
|
||||||
this._updateKeyboardFocus(viewNode);
|
|
||||||
} else {
|
|
||||||
this.hideAllViewsExcept(viewNode);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this._currentSubView = viewNode;
|
this.hideAllViewsExcept(viewNode);
|
||||||
this._transitionHeight(() => {
|
|
||||||
viewNode.setAttribute("current", true);
|
|
||||||
if (viewNode.id == this._mainViewId) {
|
|
||||||
this.node.setAttribute("viewtype", "main");
|
|
||||||
} else {
|
|
||||||
this.node.setAttribute("viewtype", "subview");
|
|
||||||
}
|
|
||||||
// Now that the subview is visible, we can check the height of the
|
|
||||||
// description elements it contains.
|
|
||||||
this.descriptionHeightWorkaround(viewNode);
|
|
||||||
this._dispatchViewEvent(viewNode, "ViewShown");
|
|
||||||
});
|
|
||||||
this._shiftMainView(aAnchor);
|
|
||||||
}
|
}
|
||||||
})().catch(e => Cu.reportError(e));
|
})().catch(e => Cu.reportError(e));
|
||||||
return this._currentShowPromise;
|
return this._currentShowPromise;
|
||||||
|
@ -901,123 +824,12 @@ this.PanelMultiView = class {
|
||||||
return maxHeight;
|
return maxHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the height transition for which <panelmultiview> is designed.
|
|
||||||
*
|
|
||||||
* The height transition involves two elements, the viewContainer and its only
|
|
||||||
* immediate child the viewStack. In order for this to work correctly, the
|
|
||||||
* viewContainer must have "overflow: hidden;" and the two elements must have
|
|
||||||
* no margins or padding. This means that the height of the viewStack is never
|
|
||||||
* limited by the viewContainer, but when the height of the container is not
|
|
||||||
* constrained it matches the height of the viewStack.
|
|
||||||
*
|
|
||||||
* @param changeFn
|
|
||||||
* This synchronous function is called to make the DOM changes
|
|
||||||
* that will result in a new height of the viewStack.
|
|
||||||
*/
|
|
||||||
_transitionHeight(changeFn) {
|
|
||||||
if (this._panel.state != "open") {
|
|
||||||
changeFn();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lock the dimensions of the window that hosts the popup panel. This
|
|
||||||
// in turn constrains the height of the viewContainer.
|
|
||||||
let rect = this._panel.popupBoxObject.getOuterScreenRect();
|
|
||||||
this._panel.setAttribute("width", rect.width);
|
|
||||||
this._panel.setAttribute("height", rect.height);
|
|
||||||
|
|
||||||
// Read the current height of the viewStack. If we are in the middle
|
|
||||||
// of a transition, this is the actual height of the element at this
|
|
||||||
// point in time.
|
|
||||||
let oldHeight = this._dwu.getBoundsWithoutFlushing(this._viewStack).height;
|
|
||||||
|
|
||||||
// Make the necessary DOM changes, and remove the "height" property of the
|
|
||||||
// viewStack to ensure that we read its final value even if we are in the
|
|
||||||
// middle of a transition. To avoid flickering, we have to prevent the panel
|
|
||||||
// from being painted in this temporary state, which requires a synchronous
|
|
||||||
// layout when reading the new height.
|
|
||||||
this._viewStack.style.removeProperty("height");
|
|
||||||
changeFn();
|
|
||||||
let newHeight = this._viewStack.getBoundingClientRect().height;
|
|
||||||
|
|
||||||
// Now we can allow the popup panel to resize again. This must occur
|
|
||||||
// in the same tick as the code below, but we can do this before
|
|
||||||
// setting the starting height in case the transition is not needed.
|
|
||||||
this._panel.removeAttribute("width");
|
|
||||||
this._panel.removeAttribute("height");
|
|
||||||
|
|
||||||
if (oldHeight != newHeight) {
|
|
||||||
// Height transitions can only occur between two numeric values, and
|
|
||||||
// cannot start if the height is not set. In case a transition is
|
|
||||||
// needed, we have to set the height to the old value, then force a
|
|
||||||
// synchronous layout so the panel won't resize unexpectedly.
|
|
||||||
this._viewStack.style.height = oldHeight + "px";
|
|
||||||
this._viewStack.getBoundingClientRect().height;
|
|
||||||
|
|
||||||
// We can now set the new height to start the transition, but
|
|
||||||
// before doing that we set up a listener to reset the height to
|
|
||||||
// "auto" at the end, so that DOM changes made after the
|
|
||||||
// transition ends are still reflected by the height of the panel.
|
|
||||||
let onTransitionEnd = event => {
|
|
||||||
if (event.target != this._viewStack) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._viewStack.removeEventListener("transitionend", onTransitionEnd);
|
|
||||||
this._viewStack.style.removeProperty("height");
|
|
||||||
};
|
|
||||||
this._viewStack.addEventListener("transitionend", onTransitionEnd);
|
|
||||||
this._viewStack.style.height = newHeight + "px";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_shiftMainView(aAnchor) {
|
|
||||||
if (aAnchor) {
|
|
||||||
// We need to find the edge of the anchor, relative to the main panel.
|
|
||||||
// Then we need to add half the width of the anchor. This is the target
|
|
||||||
// that we need to transition to.
|
|
||||||
let anchorRect = aAnchor.getBoundingClientRect();
|
|
||||||
let mainViewRect = this._mainViewContainer.getBoundingClientRect();
|
|
||||||
let center = aAnchor.clientWidth / 2;
|
|
||||||
let direction = aAnchor.ownerGlobal.getComputedStyle(aAnchor).direction;
|
|
||||||
let edge;
|
|
||||||
if (direction == "ltr") {
|
|
||||||
edge = anchorRect.left - mainViewRect.left;
|
|
||||||
} else {
|
|
||||||
edge = mainViewRect.right - anchorRect.right;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the anchor is an element on the far end of the mainView we
|
|
||||||
// don't want to shift the mainView too far, we would reveal empty
|
|
||||||
// space otherwise.
|
|
||||||
let cstyle = this.window.getComputedStyle(this.document.documentElement);
|
|
||||||
let exitSubViewGutterWidth =
|
|
||||||
cstyle.getPropertyValue("--panel-ui-exit-subview-gutter-width");
|
|
||||||
let maxShift = mainViewRect.width - parseInt(exitSubViewGutterWidth);
|
|
||||||
let target = Math.min(maxShift, edge + center);
|
|
||||||
|
|
||||||
let neg = direction == "ltr" ? "-" : "";
|
|
||||||
this._mainViewContainer.style.transform = `translateX(${neg}${target}px)`;
|
|
||||||
aAnchor.setAttribute("panel-multiview-anchor", true);
|
|
||||||
} else {
|
|
||||||
this._mainViewContainer.style.transform = "";
|
|
||||||
if (this.anchorElement)
|
|
||||||
this.anchorElement.removeAttribute("panel-multiview-anchor");
|
|
||||||
}
|
|
||||||
this.anchorElement = aAnchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleEvent(aEvent) {
|
handleEvent(aEvent) {
|
||||||
if (aEvent.type.startsWith("popup") && aEvent.target != this._panel) {
|
if (aEvent.type.startsWith("popup") && aEvent.target != this._panel) {
|
||||||
// Shouldn't act on e.g. context menus being shown from within the panel.
|
// Shouldn't act on e.g. context menus being shown from within the panel.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "click":
|
|
||||||
if (aEvent.originalTarget == this._clickCapturer) {
|
|
||||||
this.showMainView();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "keydown":
|
case "keydown":
|
||||||
this._keyNavigation(aEvent);
|
this._keyNavigation(aEvent);
|
||||||
break;
|
break;
|
||||||
|
@ -1060,27 +872,25 @@ this.PanelMultiView = class {
|
||||||
this._transitioning = false;
|
this._transitioning = false;
|
||||||
this.node.removeAttribute("panelopen");
|
this.node.removeAttribute("panelopen");
|
||||||
this.showMainView();
|
this.showMainView();
|
||||||
if (this.panelViews) {
|
for (let panelView of this._viewStack.children) {
|
||||||
for (let panelView of this._viewStack.children) {
|
if (panelView.nodeName != "children") {
|
||||||
if (panelView.nodeName != "children") {
|
panelView.__lastKnownBoundingRect = null;
|
||||||
panelView.__lastKnownBoundingRect = null;
|
panelView.style.removeProperty("min-width");
|
||||||
panelView.style.removeProperty("min-width");
|
panelView.style.removeProperty("max-width");
|
||||||
panelView.style.removeProperty("max-width");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.window.removeEventListener("keydown", this);
|
|
||||||
this._panel.removeEventListener("mousemove", this);
|
|
||||||
this._resetKeyNavigation();
|
|
||||||
|
|
||||||
// Clear the main view size caches. The dimensions could be different
|
|
||||||
// when the popup is opened again, e.g. through touch mode sizing.
|
|
||||||
this._mainViewHeight = 0;
|
|
||||||
this._mainViewWidth = 0;
|
|
||||||
this._viewContainer.style.removeProperty("min-height");
|
|
||||||
this._viewStack.style.removeProperty("max-height");
|
|
||||||
this._viewContainer.style.removeProperty("min-width");
|
|
||||||
this._viewContainer.style.removeProperty("max-width");
|
|
||||||
}
|
}
|
||||||
|
this.window.removeEventListener("keydown", this);
|
||||||
|
this._panel.removeEventListener("mousemove", this);
|
||||||
|
this._resetKeyNavigation();
|
||||||
|
|
||||||
|
// Clear the main view size caches. The dimensions could be different
|
||||||
|
// when the popup is opened again, e.g. through touch mode sizing.
|
||||||
|
this._mainViewHeight = 0;
|
||||||
|
this._mainViewWidth = 0;
|
||||||
|
this._viewContainer.style.removeProperty("min-height");
|
||||||
|
this._viewStack.style.removeProperty("max-height");
|
||||||
|
this._viewContainer.style.removeProperty("min-width");
|
||||||
|
this._viewContainer.style.removeProperty("max-width");
|
||||||
|
|
||||||
this._dispatchViewEvent(this.node, "PanelMultiViewHidden");
|
this._dispatchViewEvent(this.node, "PanelMultiViewHidden");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,45 +2,23 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
.panel-viewstack[viewtype="main"] > .panel-clickcapturer {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-viewcontainer {
|
.panel-viewcontainer {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-viewstack {
|
.panel-viewstack {
|
||||||
|
overflow: visible;
|
||||||
transition: height var(--panelui-subview-transition-duration);
|
transition: height var(--panelui-subview-transition-duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-subviews {
|
.panel-viewcontainer[panelopen] {
|
||||||
-moz-stack-sizing: ignore-horizontal;
|
|
||||||
transform: translateX(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-viewstack[viewtype="main"] > .panel-subviews {
|
|
||||||
-moz-stack-sizing: ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-subviews[panelopen] {
|
|
||||||
transition: transform var(--panelui-subview-transition-duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-viewcontainer[panelopen]:-moz-any(:not([viewtype="main"]),[transitioning]) {
|
|
||||||
transition-property: height;
|
transition-property: height;
|
||||||
transition-timing-function: var(--animation-easing-function);
|
transition-timing-function: var(--animation-easing-function);
|
||||||
transition-duration: var(--panelui-subview-transition-duration);
|
transition-duration: var(--panelui-subview-transition-duration);
|
||||||
will-change: height;
|
will-change: height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* START photon adjustments */
|
panelmultiview[transitioning] {
|
||||||
|
|
||||||
photonpanelmultiview > .panel-viewcontainer > .panel-viewstack {
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
photonpanelmultiview[transitioning] {
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,5 +33,3 @@ photonpanelmultiview[transitioning] {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END photon adjustments */
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
position="bottomcenter topright"
|
position="bottomcenter topright"
|
||||||
photon="true"
|
photon="true"
|
||||||
hidden="true">
|
hidden="true">
|
||||||
<photonpanelmultiview mainViewId="widget-overflow-mainView" disablekeynav="true">
|
<panelmultiview mainViewId="widget-overflow-mainView" disablekeynav="true">
|
||||||
<panelview id="widget-overflow-mainView"
|
<panelview id="widget-overflow-mainView"
|
||||||
context="toolbar-context-menu">
|
context="toolbar-context-menu">
|
||||||
<vbox class="panel-subview-body">
|
<vbox class="panel-subview-body">
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
accesskey="&overflowCustomizeToolbar.accesskey;"
|
accesskey="&overflowCustomizeToolbar.accesskey;"
|
||||||
label="&overflowCustomizeToolbar.label;"/>
|
label="&overflowCustomizeToolbar.label;"/>
|
||||||
</panelview>
|
</panelview>
|
||||||
</photonpanelmultiview>
|
</panelmultiview>
|
||||||
<!-- This menu is here because not having it in the menu in which it's used flickers
|
<!-- This menu is here because not having it in the menu in which it's used flickers
|
||||||
when hover styles overlap. See https://bugzilla.mozilla.org/show_bug.cgi?id=1378427 .
|
when hover styles overlap. See https://bugzilla.mozilla.org/show_bug.cgi?id=1378427 .
|
||||||
-->
|
-->
|
||||||
|
@ -164,8 +164,8 @@
|
||||||
flip="slide"
|
flip="slide"
|
||||||
position="bottomcenter topright"
|
position="bottomcenter topright"
|
||||||
noautofocus="true">
|
noautofocus="true">
|
||||||
<photonpanelmultiview id="appMenu-multiView" mainViewId="appMenu-mainView"
|
<panelmultiview id="appMenu-multiView" mainViewId="appMenu-mainView"
|
||||||
viewCacheId="appMenu-viewCache">
|
viewCacheId="appMenu-viewCache">
|
||||||
<panelview id="appMenu-mainView" class="PanelUI-subView"
|
<panelview id="appMenu-mainView" class="PanelUI-subView"
|
||||||
descriptionheightworkaround="true">
|
descriptionheightworkaround="true">
|
||||||
<vbox class="panel-subview-body">
|
<vbox class="panel-subview-body">
|
||||||
|
@ -667,7 +667,7 @@
|
||||||
label-checked="&hideBookmarksToolbar.label;"/>
|
label-checked="&hideBookmarksToolbar.label;"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
</panelview>
|
</panelview>
|
||||||
</photonpanelmultiview>
|
</panelmultiview>
|
||||||
</panel>
|
</panel>
|
||||||
|
|
||||||
<panel id="downloads-button-autohide-panel"
|
<panel id="downloads-button-autohide-panel"
|
||||||
|
|
|
@ -399,7 +399,7 @@ const PanelUI = {
|
||||||
|
|
||||||
this.ensureLibraryInitialized(viewNode);
|
this.ensureLibraryInitialized(viewNode);
|
||||||
|
|
||||||
let container = aAnchor.closest("panelmultiview,photonpanelmultiview");
|
let container = aAnchor.closest("panelmultiview");
|
||||||
if (container) {
|
if (container) {
|
||||||
container.showSubView(aViewId, aAnchor);
|
container.showSubView(aViewId, aAnchor);
|
||||||
} else if (!aAnchor.open) {
|
} else if (!aAnchor.open) {
|
||||||
|
@ -434,7 +434,7 @@ const PanelUI = {
|
||||||
let listener = () => viewShown = true;
|
let listener = () => viewShown = true;
|
||||||
viewNode.addEventListener("ViewShown", listener, {once: true});
|
viewNode.addEventListener("ViewShown", listener, {once: true});
|
||||||
|
|
||||||
let multiView = document.createElement("photonpanelmultiview");
|
let multiView = document.createElement("panelmultiview");
|
||||||
multiView.setAttribute("id", "customizationui-widget-multiview");
|
multiView.setAttribute("id", "customizationui-widget-multiview");
|
||||||
multiView.setAttribute("viewCacheId", "appMenu-viewCache");
|
multiView.setAttribute("viewCacheId", "appMenu-viewCache");
|
||||||
multiView.setAttribute("mainViewId", viewNode.id);
|
multiView.setAttribute("mainViewId", viewNode.id);
|
||||||
|
|
|
@ -18,26 +18,14 @@
|
||||||
<stylesheet src="chrome://browser/content/customizableui/panelUI.css"/>
|
<stylesheet src="chrome://browser/content/customizableui/panelUI.css"/>
|
||||||
</resources>
|
</resources>
|
||||||
<content>
|
<content>
|
||||||
<xul:vbox anonid="viewContainer" class="panel-viewcontainer" xbl:inherits="panelopen,viewtype,transitioning">
|
<xul:box anonid="viewContainer" class="panel-viewcontainer" xbl:inherits="panelopen,transitioning">
|
||||||
<xul:stack anonid="viewStack" xbl:inherits="viewtype,transitioning" class="panel-viewstack">
|
<xul:box anonid="viewStack" xbl:inherits="transitioning" class="panel-viewstack">
|
||||||
<xul:vbox anonid="mainViewContainer" class="panel-mainview" xbl:inherits="viewtype"/>
|
<children includes="panelview"/>
|
||||||
|
</xul:box>
|
||||||
<!-- Used to capture click events over the PanelUI-mainView if we're in
|
</xul:box>
|
||||||
subview mode. That way, any click on the PanelUI-mainView causes us
|
<xul:box class="panel-viewcontainer offscreen">
|
||||||
to revert to the mainView mode, whereupon PanelUI-click-capture then
|
<xul:box anonid="offscreenViewStack" class="panel-viewstack"/>
|
||||||
allows click events to go through it. -->
|
</xul:box>
|
||||||
<xul:vbox anonid="clickCapturer" class="panel-clickcapturer"/>
|
|
||||||
|
|
||||||
<!-- We manually set display: none (via a CSS attribute selector) on the
|
|
||||||
subviews that are not being displayed. We're using this over a deck
|
|
||||||
because a deck assumes the size of its largest child, regardless of
|
|
||||||
whether or not it is shown. That's not good for our case, since we
|
|
||||||
want to allow each subview to be uniquely sized. -->
|
|
||||||
<xul:vbox anonid="subViews" class="panel-subviews" xbl:inherits="panelopen">
|
|
||||||
<children includes="panelview"/>
|
|
||||||
</xul:vbox>
|
|
||||||
</xul:stack>
|
|
||||||
</xul:vbox>
|
|
||||||
</content>
|
</content>
|
||||||
<implementation>
|
<implementation>
|
||||||
<constructor><![CDATA[
|
<constructor><![CDATA[
|
||||||
|
@ -51,19 +39,6 @@
|
||||||
</implementation>
|
</implementation>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
||||||
<binding id="photonpanelmultiview" extends="chrome://browser/content/customizableui/panelUI.xml#panelmultiview">
|
|
||||||
<content>
|
|
||||||
<xul:box anonid="viewContainer" class="panel-viewcontainer" xbl:inherits="panelopen,transitioning">
|
|
||||||
<xul:box anonid="viewStack" xbl:inherits="transitioning" class="panel-viewstack">
|
|
||||||
<children includes="panelview"/>
|
|
||||||
</xul:box>
|
|
||||||
</xul:box>
|
|
||||||
<xul:box class="panel-viewcontainer offscreen">
|
|
||||||
<xul:box anonid="offscreenViewStack" class="panel-viewstack"/>
|
|
||||||
</xul:box>
|
|
||||||
</content>
|
|
||||||
</binding>
|
|
||||||
|
|
||||||
<binding id="panelview">
|
<binding id="panelview">
|
||||||
<content>
|
<content>
|
||||||
<xul:box class="panel-header" anonid="header">
|
<xul:box class="panel-header" anonid="header">
|
||||||
|
|
|
@ -46,7 +46,7 @@ add_task(async function() {
|
||||||
|
|
||||||
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
||||||
is(checkedButtons.length, 2, "There should be 2 checked items (1 charset, 1 detector).");
|
is(checkedButtons.length, 2, "There should be 2 checked items (1 charset, 1 detector).");
|
||||||
is(checkedButtons[0].getAttribute("label"), "Unicode", "The unicode encoding is correctly selected");
|
is(checkedButtons[0].getAttribute("label"), "Western", "The western encoding is correctly selected");
|
||||||
is(characterEncodingView.querySelectorAll("#PanelUI-characterEncodingView-autodetect toolbarbutton[checked='true']").length,
|
is(characterEncodingView.querySelectorAll("#PanelUI-characterEncodingView-autodetect toolbarbutton[checked='true']").length,
|
||||||
1,
|
1,
|
||||||
"There should be 1 checked detector.");
|
"There should be 1 checked detector.");
|
||||||
|
|
|
@ -26,32 +26,34 @@ add_task(async function() {
|
||||||
|
|
||||||
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
||||||
let initialEncoding = checkedButtons[0];
|
let initialEncoding = checkedButtons[0];
|
||||||
is(initialEncoding.getAttribute("label"), "Unicode", "The unicode encoding is initially selected");
|
is(initialEncoding.getAttribute("label"), "Western", "The western encoding is initially selected");
|
||||||
|
|
||||||
// change the encoding
|
// change the encoding
|
||||||
let encodings = characterEncodingView.querySelectorAll("toolbarbutton");
|
let encodings = characterEncodingView.querySelectorAll("toolbarbutton");
|
||||||
let newEncoding = encodings[0].hasAttribute("checked") ? encodings[1] : encodings[0];
|
let newEncoding = encodings[0].hasAttribute("checked") ? encodings[1] : encodings[0];
|
||||||
let tabLoadPromise = promiseTabLoadEvent(gBrowser.selectedTab, TEST_PAGE);
|
let browserStopPromise = BrowserTestUtils.browserStopped(gBrowser, TEST_PAGE);
|
||||||
newEncoding.click();
|
newEncoding.click();
|
||||||
await tabLoadPromise;
|
await browserStopPromise;
|
||||||
|
is(gBrowser.selectedBrowser.characterSet, "UTF-8", "The encoding should be changed to UTF-8");
|
||||||
|
ok(!gBrowser.selectedBrowser.mayEnableCharacterEncodingMenu, "The encoding menu should be disabled");
|
||||||
|
|
||||||
// check that the new encodng is applied
|
// check that the new encodng is applied
|
||||||
await document.getElementById("nav-bar").overflowable.show();
|
await document.getElementById("nav-bar").overflowable.show();
|
||||||
charEncodingButton.click();
|
charEncodingButton.click();
|
||||||
checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
||||||
let selectedEncodingName = checkedButtons[0].getAttribute("label");
|
let selectedEncodingName = checkedButtons[0].getAttribute("label");
|
||||||
ok(selectedEncodingName != "Unicode", "The encoding was changed to " + selectedEncodingName);
|
ok(selectedEncodingName == "Unicode", "The encoding was changed to " + selectedEncodingName);
|
||||||
|
|
||||||
// reset the initial encoding
|
CustomizableUI.removeWidgetFromArea("characterencoding-button");
|
||||||
|
CustomizableUI.addWidgetToArea("characterencoding-button",
|
||||||
|
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
|
||||||
|
await waitForOverflowButtonShown();
|
||||||
await document.getElementById("nav-bar").overflowable.show();
|
await document.getElementById("nav-bar").overflowable.show();
|
||||||
charEncodingButton.click();
|
charEncodingButton = document.getElementById("characterencoding-button");
|
||||||
tabLoadPromise = promiseTabLoadEvent(gBrowser.selectedTab, TEST_PAGE);
|
|
||||||
initialEncoding.click();
|
// check the encoding menu again
|
||||||
await tabLoadPromise;
|
is(charEncodingButton.getAttribute("disabled"), "true", "We should disable the encoding menu");
|
||||||
await document.getElementById("nav-bar").overflowable.show();
|
|
||||||
charEncodingButton.click();
|
|
||||||
checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
|
|
||||||
is(checkedButtons[0].getAttribute("label"), "Unicode", "The encoding was reset to Unicode");
|
|
||||||
await BrowserTestUtils.removeTab(newTab);
|
await BrowserTestUtils.removeTab(newTab);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ add_task(async function check_developer_subview_in_overflow() {
|
||||||
let subviewShownPromise = subviewShown(developerView);
|
let subviewShownPromise = subviewShown(developerView);
|
||||||
button.click();
|
button.click();
|
||||||
await subviewShownPromise;
|
await subviewShownPromise;
|
||||||
let hasSubviews = !!kOverflowPanel.querySelector("photonpanelmultiview,panelmultiview");
|
let hasSubviews = !!kOverflowPanel.querySelector("panelmultiview");
|
||||||
let expectedPanel = hasSubviews ? kOverflowPanel : document.getElementById("customizationui-widget-panel");
|
let expectedPanel = hasSubviews ? kOverflowPanel : document.getElementById("customizationui-widget-panel");
|
||||||
is(developerView.closest("panel"), expectedPanel, "Should be inside the panel");
|
is(developerView.closest("panel"), expectedPanel, "Should be inside the panel");
|
||||||
expectedPanel.hidePopup();
|
expectedPanel.hidePopup();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="iso-8859-1">
|
||||||
<title>Test page</title>
|
<title>Test page</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -110,21 +110,6 @@
|
||||||
</content>
|
</content>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
||||||
<binding id="download-toolbarbutton"
|
|
||||||
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-badged">
|
|
||||||
<content>
|
|
||||||
<xul:stack class="toolbarbutton-badge-stack">
|
|
||||||
<children />
|
|
||||||
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label,consumeanchor"/>
|
|
||||||
<xul:label class="toolbarbutton-badge" xbl:inherits="value=badge" top="0" end="0" crop="none"/>
|
|
||||||
</xul:stack>
|
|
||||||
<xul:label class="toolbarbutton-text" crop="right" flex="1"
|
|
||||||
xbl:inherits="value=label,accesskey,crop,wrap"/>
|
|
||||||
<xul:label class="toolbarbutton-multiline-text" flex="1"
|
|
||||||
xbl:inherits="xbl:text=label,accesskey,wrap"/>
|
|
||||||
</content>
|
|
||||||
</binding>
|
|
||||||
|
|
||||||
<binding id="download-subview-toolbarbutton"
|
<binding id="download-subview-toolbarbutton"
|
||||||
extends="chrome://global/content/bindings/button.xml#menu-button-base">
|
extends="chrome://global/content/bindings/button.xml#menu-button-base">
|
||||||
<content>
|
<content>
|
||||||
|
|
|
@ -198,8 +198,7 @@ richlistitem.download button {
|
||||||
/* Make the panel wide enough to show the download list items without improperly
|
/* Make the panel wide enough to show the download list items without improperly
|
||||||
truncating them. */
|
truncating them. */
|
||||||
#downloadsPanel-multiView > .panel-viewcontainer,
|
#downloadsPanel-multiView > .panel-viewcontainer,
|
||||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack,
|
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack {
|
||||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack > .panel-mainview {
|
|
||||||
max-width: unset;
|
max-width: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@
|
||||||
label="&cmd.clearDownloads.label;"/>
|
label="&cmd.clearDownloads.label;"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
|
|
||||||
<photonpanelmultiview id="downloadsPanel-multiView"
|
<panelmultiview id="downloadsPanel-multiView"
|
||||||
mainViewId="downloadsPanel-mainView">
|
mainViewId="downloadsPanel-mainView">
|
||||||
|
|
||||||
<panelview id="downloadsPanel-mainView">
|
<panelview id="downloadsPanel-mainView">
|
||||||
<vbox class="panel-view-body-unscrollable">
|
<vbox class="panel-view-body-unscrollable">
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
oncommand="BrowserDownloadsUI(); CustomizableUI.hidePanelForNode(this);"/>
|
oncommand="BrowserDownloadsUI(); CustomizableUI.hidePanelForNode(this);"/>
|
||||||
</panelview>
|
</panelview>
|
||||||
|
|
||||||
</photonpanelmultiview>
|
</panelmultiview>
|
||||||
|
|
||||||
</panel>
|
</panel>
|
||||||
</popupset>
|
</popupset>
|
||||||
|
|
|
@ -2204,7 +2204,7 @@ BrowserGlue.prototype = {
|
||||||
let defaultEngine = Services.search.originalDefaultEngine;
|
let defaultEngine = Services.search.originalDefaultEngine;
|
||||||
defaultEngine.hidden = false;
|
defaultEngine.hidden = false;
|
||||||
Services.search.currentEngine = defaultEngine;
|
Services.search.currentEngine = defaultEngine;
|
||||||
Services.prefs.setIntPref("browser.search.reset.status", "silent");
|
Services.prefs.setCharPref("browser.search.reset.status", "silent");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<p>&searchreset.pageInfo1;</p>
|
<p>&searchreset.pageInfo1;</p>
|
||||||
<p>&searchreset.selector.label;<span id="defaultEngine"/></p>
|
<p>&searchreset.selector.label;<span id="defaultEngine"/></p>
|
||||||
|
|
||||||
<p>&searchreset.beforelink.pageInfo2;<a id="linkSettingsPage" href="about:preferences">&searchreset.link.pageInfo2;</a>&searchreset.afterlink.pageInfo2;</p>
|
<p>&searchreset.beforelink.pageInfo2;<a id="linkSettingsPage" href="about:preferences#search">&searchreset.link.pageInfo2;</a>&searchreset.afterlink.pageInfo2;</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
|
|
|
@ -115,7 +115,7 @@ var gTests = [
|
||||||
Services.prefs.setCharPref(kStatusPref, "pending");
|
Services.prefs.setCharPref(kStatusPref, "pending");
|
||||||
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
|
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
|
||||||
false,
|
false,
|
||||||
"about:preferences");
|
"about:preferences#search");
|
||||||
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||||
gBrowser.contentDocument.getElementById("linkSettingsPage").click();
|
gBrowser.contentDocument.getElementById("linkSettingsPage").click();
|
||||||
await loadPromise;
|
await loadPromise;
|
||||||
|
|
|
@ -219,7 +219,7 @@ skip-if = true # Needs to be rewritten as Marionette test, bug 995916
|
||||||
[browser_739531.js]
|
[browser_739531.js]
|
||||||
[browser_739805.js]
|
[browser_739805.js]
|
||||||
[browser_819510_perwindowpb.js]
|
[browser_819510_perwindowpb.js]
|
||||||
skip-if = (os == 'win' && bits == 64) || (os == "mac") # Win: Bug 1284312, Mac: Bug 1341980
|
skip-if = (os == 'win' && bits == 64) || (os == "mac") || (os == "linux") # Win: Bug 1284312, Mac: Bug 1341980, Linux: bug 1381451
|
||||||
[browser_not_collect_when_idle.js]
|
[browser_not_collect_when_idle.js]
|
||||||
|
|
||||||
# Disabled for frequent intermittent failures
|
# Disabled for frequent intermittent failures
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||||
|
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||||
|
MOZ_AUTOMATION_L10N_CHECK=0
|
||||||
|
|
||||||
|
. "$topsrcdir/build/mozconfig.common"
|
||||||
|
|
||||||
|
ac_add_options --enable-debug
|
||||||
|
ac_add_options --enable-dmd
|
||||||
|
|
||||||
|
. $topsrcdir/build/mozconfig.stylo
|
||||||
|
|
||||||
|
# Use Clang as specified in manifest
|
||||||
|
export CC="$topsrcdir/clang/bin/clang"
|
||||||
|
export CXX="$topsrcdir/clang/bin/clang++"
|
||||||
|
|
||||||
|
# Add the static checker
|
||||||
|
ac_add_options --enable-clang-plugin
|
||||||
|
ac_add_options --enable-mozsearch-plugin
|
||||||
|
|
||||||
|
. "$topsrcdir/build/unix/mozconfig.stdcxx"
|
||||||
|
|
||||||
|
export PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig:/usr/share/pkgconfig
|
||||||
|
. $topsrcdir/build/unix/mozconfig.gtk
|
||||||
|
|
||||||
|
. "$topsrcdir/build/mozconfig.common.override"
|
|
@ -0,0 +1,13 @@
|
||||||
|
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||||
|
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||||
|
MOZ_AUTOMATION_L10N_CHECK=0
|
||||||
|
|
||||||
|
. $topsrcdir/build/macosx/mozconfig.common
|
||||||
|
|
||||||
|
ac_add_options --enable-debug
|
||||||
|
ac_add_options --enable-dmd
|
||||||
|
|
||||||
|
ac_add_options --enable-clang-plugin
|
||||||
|
ac_add_options --enable-mozsearch-plugin
|
||||||
|
|
||||||
|
. "$topsrcdir/build/mozconfig.common.override"
|
|
@ -0,0 +1,17 @@
|
||||||
|
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||||
|
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||||
|
MOZ_AUTOMATION_L10N_CHECK=0
|
||||||
|
|
||||||
|
. "$topsrcdir/build/mozconfig.win-common"
|
||||||
|
. "$topsrcdir/browser/config/mozconfigs/common"
|
||||||
|
|
||||||
|
ac_add_options --enable-optimize
|
||||||
|
ac_add_options --enable-debug
|
||||||
|
|
||||||
|
ac_add_options --enable-clang-plugin
|
||||||
|
ac_add_options --enable-mozsearch-plugin
|
||||||
|
|
||||||
|
. $topsrcdir/build/win32/mozconfig.vs-latest
|
||||||
|
|
||||||
|
. "$topsrcdir/build/mozconfig.common.override"
|
||||||
|
. "$topsrcdir/build/mozconfig.clang-cl"
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
%include ../../shared/customizableui/panelUI.inc.css
|
%include ../../shared/customizableui/panelUI.inc.css
|
||||||
|
|
||||||
.panel-subviews {
|
|
||||||
background-color: var(--arrowpanel-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
#BMB_bookmarksPopup > menuitem[type="checkbox"] {
|
#BMB_bookmarksPopup > menuitem[type="checkbox"] {
|
||||||
-moz-appearance: none !important; /* important, to override toolkit rule */
|
-moz-appearance: none !important; /* important, to override toolkit rule */
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,6 @@
|
||||||
box-shadow: var(--focus-ring-box-shadow);
|
box-shadow: var(--focus-ring-box-shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
#identity-popup-multiView > .panel-viewcontainer > .panel-viewstack > .panel-subviews {
|
|
||||||
border-bottom-right-radius: 3.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#identity-popup-multiView > .panel-viewcontainer > .panel-viewstack > .panel-subviews:-moz-locale-dir(rtl) {
|
|
||||||
border-bottom-right-radius: 0;
|
|
||||||
border-bottom-left-radius: 3.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tracking-action-block,
|
#tracking-action-block,
|
||||||
#tracking-action-unblock,
|
#tracking-action-unblock,
|
||||||
#tracking-action-unblock-private,
|
#tracking-action-unblock-private,
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
%include ../../shared/customizableui/panelUI.inc.css
|
%include ../../shared/customizableui/panelUI.inc.css
|
||||||
|
|
||||||
.panel-subviews {
|
|
||||||
background-color: hsla(0,0%,100%,.97);
|
|
||||||
}
|
|
||||||
|
|
||||||
.restoreallitem > .toolbarbutton-icon {
|
.restoreallitem > .toolbarbutton-icon {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +16,7 @@
|
||||||
padding-inline-start: 14px;
|
padding-inline-start: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .toolbaritem-combined-buttons > spacer {
|
panelmultiview .toolbaritem-combined-buttons > spacer {
|
||||||
width: 42px; /* 18px toolbarbutton padding + 16px icon + 8px label padding start */
|
width: 42px; /* 18px toolbarbutton padding + 16px icon + 8px label padding start */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,20 +68,6 @@
|
||||||
max-width: 30em;
|
max-width: 30em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#identity-popup-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="main"] > .panel-subviews {
|
|
||||||
transform: translateX(100%);
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#identity-popup-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="main"] > .panel-subviews:-moz-locale-dir(rtl) {
|
|
||||||
transform: translateX(-100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
#identity-popup-multiView > .panel-viewcontainer > .panel-viewstack > .panel-subviews {
|
|
||||||
background: var(--arrowpanel-background);
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.identity-popup-section:not(:first-child) {
|
.identity-popup-section:not(:first-child) {
|
||||||
border-top: 1px solid var(--panel-separator-color);
|
border-top: 1px solid var(--panel-separator-color);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +150,7 @@
|
||||||
.identity-popup-host {
|
.identity-popup-host {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
/* 1em + 2em + 24px is .identity-popup-security-content padding
|
/* 1em + 2em + 24px is .identity-popup-security-content padding
|
||||||
* 30em is .panel-mainview width */
|
* 30em is the panel width */
|
||||||
max-width: calc(30rem - 3rem - 24px - @identityPopupExpanderWidth@);
|
max-width: calc(30rem - 3rem - 24px - @identityPopupExpanderWidth@);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
%define panelPaletteIconSize 16px
|
%define panelPaletteIconSize 16px
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--panel-ui-exit-subview-gutter-width: 38px;
|
|
||||||
--appmenu-yellow-warning-border-color: hsl(45, 100%, 77%);
|
--appmenu-yellow-warning-border-color: hsl(45, 100%, 77%);
|
||||||
--appmenu-yellow-warning-color: #FFEFBF;
|
--appmenu-yellow-warning-color: #FFEFBF;
|
||||||
--appmenu-yellow-warning-hover-color: #FFE8A2;
|
--appmenu-yellow-warning-hover-color: #FFE8A2;
|
||||||
|
@ -114,26 +113,11 @@
|
||||||
background: #FFBF00 url(chrome://browser/skin/update-badge-failed.svg) no-repeat center;
|
background: #FFBF00 url(chrome://browser/skin/update-badge-failed.svg) no-repeat center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-subviews {
|
|
||||||
padding: 4px;
|
|
||||||
background-clip: padding-box;
|
|
||||||
border-left: 1px solid var(--arrowpanel-border-color);
|
|
||||||
box-shadow: 0 3px 5px hsla(210,4%,10%,.1),
|
|
||||||
0 0 7px hsla(210,4%,10%,.1);
|
|
||||||
margin-inline-start: var(--panel-ui-exit-subview-gutter-width);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-viewstack[viewtype="main"] > .panel-subviews {
|
|
||||||
transform: translateX(@menuPanelWidth@);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-viewstack[viewtype="main"] > .panel-subviews:-moz-locale-dir(rtl) {
|
|
||||||
transform: translateX(-@menuPanelWidth@);
|
|
||||||
}
|
|
||||||
|
|
||||||
panelview {
|
panelview {
|
||||||
-moz-box-orient: vertical;
|
-moz-box-orient: vertical;
|
||||||
-moz-box-flex: 1;
|
-moz-box-flex: 1;
|
||||||
|
background: var(--arrowpanel-background);
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This section is to anchor all the drop down panels at the same height, shift the
|
/* This section is to anchor all the drop down panels at the same height, shift the
|
||||||
|
@ -200,6 +184,7 @@ panelview {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
-moz-box-flex: 1;
|
-moz-box-flex: 1;
|
||||||
|
padding: 6px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-view-body-unscrollable {
|
.panel-view-body-unscrollable {
|
||||||
|
@ -242,8 +227,7 @@ panel[photon] > .panel-arrowcontainer > .panel-arrowcontent {
|
||||||
margin-inline-start: 0;
|
margin-inline-start: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#BMB_bookmarksPopup,
|
#BMB_bookmarksPopup {
|
||||||
.panel-mainview {
|
|
||||||
max-width: @standaloneSubviewWidth@;
|
max-width: @standaloneSubviewWidth@;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,11 +307,6 @@ panel[photon] > .panel-arrowcontainer > .panel-arrowcontent {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give WebExtension stand-alone panels extra width for Chrome compatibility */
|
|
||||||
.cui-widget-panel[viewId^=PanelUI-webext-] .panel-mainview {
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cui-widget-panel[viewId^=PanelUI-webext-] > .panel-arrowcontainer > .panel-arrowcontent {
|
.cui-widget-panel[viewId^=PanelUI-webext-] > .panel-arrowcontainer > .panel-arrowcontent {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
@ -347,18 +326,11 @@ panelview:not([mainview]) .toolbarbutton-text,
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* START photonpanelview adjustments */
|
|
||||||
|
|
||||||
#appMenu-popup > .panel-arrowcontainer > .panel-arrowcontent,
|
#appMenu-popup > .panel-arrowcontainer > .panel-arrowcontent,
|
||||||
panel[photon] > .panel-arrowcontainer > .panel-arrowcontent {
|
panel[photon] > .panel-arrowcontainer > .panel-arrowcontent {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview panelview {
|
|
||||||
background: var(--arrowpanel-background);
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#appMenu-popup panelview,
|
#appMenu-popup panelview,
|
||||||
#customizationui-widget-multiview panelview:not([extension]) {
|
#customizationui-widget-multiview panelview:not([extension]) {
|
||||||
min-width: @menuPanelWidth@;
|
min-width: @menuPanelWidth@;
|
||||||
|
@ -377,12 +349,6 @@ photonpanelmultiview panelview {
|
||||||
min-width: calc(@menuPanelWidth@ + 32px);
|
min-width: calc(@menuPanelWidth@ + 32px);
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .panel-subview-body {
|
|
||||||
padding: 6px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* END photonpanelview adjustments */
|
|
||||||
|
|
||||||
.cui-widget-panel.cui-widget-panelWithFooter > .panel-arrowcontainer > .panel-arrowcontent {
|
.cui-widget-panel.cui-widget-panelWithFooter > .panel-arrowcontainer > .panel-arrowcontent {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
@ -461,7 +427,8 @@ toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton
|
||||||
content: "";
|
content: "";
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
margin-inline-end: 16.5px;
|
margin-inline-start: 10px;
|
||||||
|
margin-inline-end: 12px;
|
||||||
display: -moz-box;
|
display: -moz-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,25 +871,9 @@ panelview .toolbarbutton-1,
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* START photon adjustments */
|
|
||||||
|
|
||||||
.subviewbutton[checked="true"] {
|
.subviewbutton[checked="true"] {
|
||||||
background: url(chrome://browser/skin/check.svg) center left 7px / 11px 11px no-repeat transparent;
|
|
||||||
fill: currentColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subviewbutton[checked="true"]:-moz-locale-dir(rtl) {
|
|
||||||
background-position: center right 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
photonpanelmultiview .subviewbutton[checked="true"] {
|
|
||||||
background: none;
|
|
||||||
list-style-image: url(chrome://browser/skin/check.svg);
|
list-style-image: url(chrome://browser/skin/check.svg);
|
||||||
}
|
fill: currentColor;
|
||||||
|
|
||||||
photonpanelmultiview .subviewbutton > .menu-iconic-left {
|
|
||||||
-moz-appearance: none;
|
|
||||||
margin-inline-end: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#appMenu-popup .toolbaritem-combined-buttons {
|
#appMenu-popup .toolbaritem-combined-buttons {
|
||||||
|
@ -933,22 +884,22 @@ photonpanelmultiview .subviewbutton > .menu-iconic-left {
|
||||||
margin-inline-end: 8px;
|
margin-inline-end: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .toolbaritem-combined-buttons > label {
|
panelmultiview .toolbaritem-combined-buttons > label {
|
||||||
-moz-box-flex: 1;
|
-moz-box-flex: 1;
|
||||||
font: menu;
|
font: menu;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .toolbaritem-combined-buttons > spacer.before-label {
|
panelmultiview .toolbaritem-combined-buttons > spacer.before-label {
|
||||||
width: 36px; /* 12px toolbarbutton padding + 16px icon + 8px label padding start */
|
width: 36px; /* 12px toolbarbutton padding + 16px icon + 8px label padding start */
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .toolbaritem-combined-buttons > spacer.after-label {
|
panelmultiview .toolbaritem-combined-buttons > spacer.after-label {
|
||||||
-moz-box-flex: 1;
|
-moz-box-flex: 1;
|
||||||
width: 20px; /* a little bigger than the width of the scrollbar */
|
width: 20px; /* a little bigger than the width of the scrollbar */
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .PanelUI-subView .toolbaritem-combined-buttons > .subviewbutton {
|
.PanelUI-subView .toolbaritem-combined-buttons > .subviewbutton {
|
||||||
-moz-box-flex: 0;
|
-moz-box-flex: 0;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin-inline-start: 18px;
|
margin-inline-start: 18px;
|
||||||
|
@ -975,44 +926,33 @@ photonpanelmultiview .PanelUI-subView .toolbaritem-combined-buttons > .subviewbu
|
||||||
margin-inline-start: 0;
|
margin-inline-start: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .PanelUI-subView .toolbaritem-combined-buttons >
|
.PanelUI-subView .toolbaritem-combined-buttons > .subviewbutton-iconic > .toolbarbutton-text,
|
||||||
.subviewbutton-iconic > .toolbarbutton-text,
|
.PanelUI-subView .toolbaritem-combined-buttons > .subviewbutton:not(.subviewbutton-iconic) > .toolbarbutton-icon {
|
||||||
photonpanelmultiview .PanelUI-subView .toolbaritem-combined-buttons >
|
|
||||||
.subviewbutton:not(.subviewbutton-iconic) > .toolbarbutton-icon {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Using this selector, because this way the hover and active selectors will apply properly. */
|
/* Using this selector, because this way the hover and active selectors will apply properly. */
|
||||||
photonpanelmultiview .PanelUI-subView .toolbaritem-combined-buttons >
|
.PanelUI-subView .toolbaritem-combined-buttons > .subviewbutton:not(.subviewbutton-iconic) {
|
||||||
.subviewbutton:not(.subviewbutton-iconic) {
|
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
border: 1px solid #e1e1e1;
|
border: 1px solid #e1e1e1;
|
||||||
border-radius: 10000px;
|
border-radius: 10000px;
|
||||||
padding: 1px 8px;
|
padding: 1px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .toolbaritem-combined-buttons > .subviewbutton:not(.subviewbutton-iconic) > .toolbarbutton-text {
|
.toolbaritem-combined-buttons > .subviewbutton:not(.subviewbutton-iconic) > .toolbarbutton-text {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
padding-inline-start: 0;
|
padding-inline-start: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .addon-banner-item::after,
|
.subview-subheader {
|
||||||
photonpanelmultiview .panel-banner-item::after {
|
|
||||||
margin-inline-end: 12px;
|
|
||||||
margin-inline-start: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
photonpanelmultiview .subview-subheader {
|
|
||||||
color: GrayText;
|
color: GrayText;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .subview-subheader,
|
.subview-subheader,
|
||||||
photonpanelmultiview .panel-subview-footer {
|
.panel-subview-footer {
|
||||||
font: menu;
|
font: menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END photon adjustments */
|
|
||||||
|
|
||||||
panelview .toolbarbutton-1 {
|
panelview .toolbarbutton-1 {
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
|
@ -1108,12 +1048,16 @@ menuitem.panel-subview-footer@menuStateActive@,
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.PanelUI-subView menuseparator,
|
.PanelUI-subView menuseparator {
|
||||||
.PanelUI-subView toolbarseparator {
|
|
||||||
margin-inline-start: -5px;
|
margin-inline-start: -5px;
|
||||||
margin-inline-end: -4px;
|
margin-inline-end: -4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.PanelUI-subView toolbarseparator {
|
||||||
|
margin-inline-start: 0;
|
||||||
|
margin-inline-end: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.PanelUI-subView menuseparator.small-separator,
|
.PanelUI-subView menuseparator.small-separator,
|
||||||
.PanelUI-subView toolbarseparator.small-separator {
|
.PanelUI-subView toolbarseparator.small-separator {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
@ -1240,7 +1184,6 @@ toolbarpaletteitem[place=panel] > .toolbaritem-combined-buttons > toolbarbutton
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cui-widget-panelview,
|
|
||||||
#widget-overflow-mainView .panel-subview-body {
|
#widget-overflow-mainView .panel-subview-body {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
@ -1293,14 +1236,13 @@ toolbarpaletteitem[place=panel] > .subviewbutton-nav::after {
|
||||||
|
|
||||||
.subviewbutton > .menu-iconic-left {
|
.subviewbutton > .menu-iconic-left {
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
margin-inline-end: 3px;
|
margin-inline-end: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-mainview[panelid=customizationui-widget-panel],
|
|
||||||
#PanelUI-panicView > .panel-subview-body,
|
#PanelUI-panicView > .panel-subview-body,
|
||||||
#PanelUI-panicView {
|
#PanelUI-panicView {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
|
@ -1493,8 +1435,6 @@ menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* START photon adjustments */
|
|
||||||
|
|
||||||
.panel-header {
|
.panel-header {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px solid var(--panel-separator-color);
|
border-bottom: 1px solid var(--panel-separator-color);
|
||||||
|
@ -1514,7 +1454,7 @@ menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .PanelUI-subView .panel-header > .subviewbutton-back {
|
.PanelUI-subView .panel-header > .subviewbutton-back {
|
||||||
-moz-context-properties: fill;
|
-moz-context-properties: fill;
|
||||||
fill: var(--arrowpanel-color);
|
fill: var(--arrowpanel-color);
|
||||||
list-style-image: url(chrome://browser/skin/arrow-left.svg);
|
list-style-image: url(chrome://browser/skin/arrow-left.svg);
|
||||||
|
@ -1531,18 +1471,7 @@ photonpanelmultiview .PanelUI-subView .panel-header > .subviewbutton-back {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
photonpanelmultiview .PanelUI-subView toolbarseparator {
|
#panelMenu_pocket {
|
||||||
margin-inline-start: 0;
|
|
||||||
margin-inline-end: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is explicitly overriding the overflow properties set above. */
|
|
||||||
photonpanelmultiview .cui-widget-panelview {
|
|
||||||
overflow-x: visible;
|
|
||||||
overflow-y: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
photonpanelmultiview #panelMenu_pocket {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1597,5 +1526,3 @@ photonpanelmultiview #panelMenu_pocket {
|
||||||
.subviewbutton.download:-moz-any([openLabel],[retryLabel]) > .action-button@buttonStateActive@ {
|
.subviewbutton.download:-moz-any([openLabel],[retryLabel]) > .action-button@buttonStateActive@ {
|
||||||
background-color: var(--arrowpanel-dimmed-even-further);
|
background-color: var(--arrowpanel-dimmed-even-further);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END photon adjustments */
|
|
||||||
|
|
|
@ -15,10 +15,6 @@
|
||||||
|
|
||||||
#downloadsPanel > .panel-arrowcontainer > .panel-arrowcontent {
|
#downloadsPanel > .panel-arrowcontainer > .panel-arrowcontent {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
|
||||||
|
|
||||||
#downloadsPanel > .panel-arrowcontainer > .panel-arrowcontent,
|
|
||||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack > .panel-subviews {
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
%include ../../shared/customizableui/panelUI.inc.css
|
%include ../../shared/customizableui/panelUI.inc.css
|
||||||
|
|
||||||
.panel-subviews {
|
|
||||||
background-color: var(--arrowpanel-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bookmark panel submenus */
|
/* bookmark panel submenus */
|
||||||
|
|
||||||
#BMB_bookmarksPopup menupopup[placespopup=true] {
|
#BMB_bookmarksPopup menupopup[placespopup=true] {
|
||||||
|
|
|
@ -3864,7 +3864,6 @@ ItemIsActive(nsIDocShellTreeItem* aItem)
|
||||||
{
|
{
|
||||||
if (nsCOMPtr<nsPIDOMWindowOuter> window = aItem->GetWindow()) {
|
if (nsCOMPtr<nsPIDOMWindowOuter> window = aItem->GetWindow()) {
|
||||||
auto* win = nsGlobalWindowOuter::Cast(window);
|
auto* win = nsGlobalWindowOuter::Cast(window);
|
||||||
MOZ_ASSERT(win->IsOuterWindow());
|
|
||||||
if (!win->GetClosedOuter()) {
|
if (!win->GetClosedOuter()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
@ -77,8 +75,6 @@ AudioChannelAgent::InitWithWeakCallback(mozIDOMWindow* aWindow,
|
||||||
nsresult
|
nsresult
|
||||||
AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow)
|
AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
mWindow = aWindow->GetScriptableTop();
|
mWindow = aWindow->GetScriptableTop();
|
||||||
if (NS_WARN_IF(!mWindow)) {
|
if (NS_WARN_IF(!mWindow)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -142,7 +138,6 @@ AudioChannelAgent::InitInternal(nsPIDOMWindowInner* aWindow,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
mInnerWindowID = aWindow->WindowID();
|
mInnerWindowID = aWindow->WindowID();
|
||||||
|
|
||||||
nsresult rv = FindCorrectWindow(aWindow);
|
nsresult rv = FindCorrectWindow(aWindow);
|
||||||
|
|
|
@ -345,12 +345,10 @@ AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
|
||||||
AudioPlaybackConfig
|
AudioPlaybackConfig
|
||||||
AudioChannelService::GetMediaConfig(nsPIDOMWindowOuter* aWindow) const
|
AudioChannelService::GetMediaConfig(nsPIDOMWindowOuter* aWindow) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!aWindow || aWindow->IsOuterWindow());
|
|
||||||
|
|
||||||
AudioPlaybackConfig config(1.0, false,
|
AudioPlaybackConfig config(1.0, false,
|
||||||
nsISuspendedTypes::NONE_SUSPENDED);
|
nsISuspendedTypes::NONE_SUSPENDED);
|
||||||
|
|
||||||
if (!aWindow || !aWindow->IsOuterWindow()) {
|
if (!aWindow) {
|
||||||
config.SetConfig(0.0, true,
|
config.SetConfig(0.0, true,
|
||||||
nsISuspendedTypes::SUSPENDED_BLOCK);
|
nsISuspendedTypes::SUSPENDED_BLOCK);
|
||||||
return config;
|
return config;
|
||||||
|
@ -452,7 +450,6 @@ AudioChannelService::RefreshAgents(nsPIDOMWindowOuter* aWindow,
|
||||||
const std::function<void(AudioChannelAgent*)>& aFunc)
|
const std::function<void(AudioChannelAgent*)>& aFunc)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
|
nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
|
||||||
if (!topWindow) {
|
if (!topWindow) {
|
||||||
|
@ -495,7 +492,6 @@ AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow,
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
|
||||||
|
|
||||||
MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
|
MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
|
||||||
("AudioChannelService, SetWindowAudioCaptured, window = %p, "
|
("AudioChannelService, SetWindowAudioCaptured, window = %p, "
|
||||||
|
@ -532,7 +528,6 @@ AudioChannelService::GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
|
||||||
|
|
||||||
AudioChannelWindow* winData = GetWindowData(aWindow->WindowID());
|
AudioChannelWindow* winData = GetWindowData(aWindow->WindowID());
|
||||||
if (!winData) {
|
if (!winData) {
|
||||||
|
@ -595,7 +590,6 @@ void
|
||||||
AudioChannelService::NotifyMediaResumedFromBlock(nsPIDOMWindowOuter* aWindow)
|
AudioChannelService::NotifyMediaResumedFromBlock(nsPIDOMWindowOuter* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
|
nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
|
||||||
if (!topWindow) {
|
if (!topWindow) {
|
||||||
|
@ -974,7 +968,6 @@ AudioChannelService::AudioChannelWindow::MaybeNotifyMediaBlockStart(AudioChannel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(window->IsOuterWindow());
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> inner = window->GetCurrentInnerWindow();
|
nsCOMPtr<nsPIDOMWindowInner> inner = window->GetCurrentInnerWindow();
|
||||||
if (!inner) {
|
if (!inner) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace dom {
|
||||||
BarProp::BarProp(nsGlobalWindowInner* aWindow)
|
BarProp::BarProp(nsGlobalWindowInner* aWindow)
|
||||||
: mDOMWindow(aWindow)
|
: mDOMWindow(aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BarProp::~BarProp()
|
BarProp::~BarProp()
|
||||||
|
|
|
@ -224,7 +224,6 @@ CustomElementRegistry::CustomElementRegistry(nsPIDOMWindowInner* aWindow)
|
||||||
, mIsCustomDefinitionRunning(false)
|
, mIsCustomDefinitionRunning(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
MOZ_ALWAYS_TRUE(mConstructors.init());
|
MOZ_ALWAYS_TRUE(mConstructors.init());
|
||||||
|
|
||||||
mozilla::HoldJSObjects(this);
|
mozilla::HoldJSObjects(this);
|
||||||
|
|
|
@ -1965,8 +1965,7 @@ EventSource::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||||
nsCOMPtr<nsPIDOMWindowInner> ownerWindow =
|
nsCOMPtr<nsPIDOMWindowInner> ownerWindow =
|
||||||
do_QueryInterface(aGlobal.GetAsSupports());
|
do_QueryInterface(aGlobal.GetAsSupports());
|
||||||
|
|
||||||
MOZ_ASSERT(!NS_IsMainThread() ||
|
MOZ_ASSERT(!NS_IsMainThread() || ownerWindow);
|
||||||
(ownerWindow && ownerWindow->IsInnerWindow()));
|
|
||||||
|
|
||||||
RefPtr<EventSource> eventSource =
|
RefPtr<EventSource> eventSource =
|
||||||
new EventSource(ownerWindow, aEventSourceInitDict.mWithCredentials);
|
new EventSource(ownerWindow, aEventSourceInitDict.mWithCredentials);
|
||||||
|
|
|
@ -42,8 +42,6 @@ namespace dom {
|
||||||
Location::Location(nsPIDOMWindowInner* aWindow, nsIDocShell *aDocShell)
|
Location::Location(nsPIDOMWindowInner* aWindow, nsIDocShell *aDocShell)
|
||||||
: mInnerWindow(aWindow)
|
: mInnerWindow(aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mInnerWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
// aDocShell can be null if it gets called after nsDocShell::Destory().
|
// aDocShell can be null if it gets called after nsDocShell::Destory().
|
||||||
mDocShell = do_GetWeakReference(aDocShell);
|
mDocShell = do_GetWeakReference(aDocShell);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,6 @@ Navigator::Init()
|
||||||
Navigator::Navigator(nsPIDOMWindowInner* aWindow)
|
Navigator::Navigator(nsPIDOMWindowInner* aWindow)
|
||||||
: mWindow(aWindow)
|
: mWindow(aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow(), "Navigator must get an inner window!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigator::~Navigator()
|
Navigator::~Navigator()
|
||||||
|
@ -1628,8 +1627,6 @@ Navigator::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||||
void
|
void
|
||||||
Navigator::SetWindow(nsPIDOMWindowInner *aInnerWindow)
|
Navigator::SetWindow(nsPIDOMWindowInner *aInnerWindow)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aInnerWindow->IsInnerWindow(),
|
|
||||||
"Navigator must get an inner window!");
|
|
||||||
mWindow = aInnerWindow;
|
mWindow = aInnerWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1712,7 +1709,6 @@ Navigator::GetWindowFromGlobal(JSObject* aGlobal)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win =
|
nsCOMPtr<nsPIDOMWindowInner> win =
|
||||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(aGlobal));
|
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(aGlobal));
|
||||||
MOZ_ASSERT(!win || win->IsInnerWindow());
|
|
||||||
return win.forget();
|
return win.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,6 @@ PostMessageEvent::~PostMessageEvent()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PostMessageEvent::Run()
|
PostMessageEvent::Run()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mTargetWindow->IsOuterWindow(),
|
|
||||||
"should have been passed an outer window!");
|
|
||||||
MOZ_ASSERT(!mSource || mSource->IsOuterWindow(),
|
|
||||||
"should have been passed an outer window!");
|
|
||||||
|
|
||||||
// Note: We don't init this AutoJSAPI with targetWindow, because we do not
|
// Note: We don't init this AutoJSAPI with targetWindow, because we do not
|
||||||
// want exceptions during message deserialization to trigger error events on
|
// want exceptions during message deserialization to trigger error events on
|
||||||
// targetWindow.
|
// targetWindow.
|
||||||
|
@ -82,8 +77,6 @@ PostMessageEvent::Run()
|
||||||
targetWindow->IsClosedOrClosing())
|
targetWindow->IsClosedOrClosing())
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
MOZ_ASSERT(targetWindow->IsInnerWindow(),
|
|
||||||
"we ordered an inner window!");
|
|
||||||
JSAutoCompartment ac(cx, targetWindow->GetWrapper());
|
JSAutoCompartment ac(cx, targetWindow->GetWrapper());
|
||||||
|
|
||||||
// Ensure that any origin which might have been provided is the origin of this
|
// Ensure that any origin which might have been provided is the origin of this
|
||||||
|
|
|
@ -410,8 +410,6 @@ TimeoutManager::TimeoutManager(nsGlobalWindowInner& aWindow)
|
||||||
mThrottleTrackingTimeouts(false),
|
mThrottleTrackingTimeouts(false),
|
||||||
mBudgetThrottleTimeouts(false)
|
mBudgetThrottleTimeouts(false)
|
||||||
{
|
{
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aWindow.IsInnerWindow());
|
|
||||||
|
|
||||||
MOZ_LOG(gLog, LogLevel::Debug,
|
MOZ_LOG(gLog, LogLevel::Debug,
|
||||||
("TimeoutManager %p created, tracking bucketing %s\n",
|
("TimeoutManager %p created, tracking bucketing %s\n",
|
||||||
this, gAnnotateTrackingChannels ? "enabled" : "disabled"));
|
this, gAnnotateTrackingChannels ? "enabled" : "disabled"));
|
||||||
|
@ -587,7 +585,7 @@ TimeoutManager::SetTimeout(nsITimeoutHandler* aHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gRunningTimeoutDepth == 0 &&
|
if (gRunningTimeoutDepth == 0 &&
|
||||||
mWindow.GetPopupControlState() < openBlocked) {
|
nsContentUtils::GetPopupControlState() < openBlocked) {
|
||||||
// This timeout is *not* set from another timeout and it's set
|
// This timeout is *not* set from another timeout and it's set
|
||||||
// while popups are enabled. Propagate the state to the timeout if
|
// while popups are enabled. Propagate the state to the timeout if
|
||||||
// its delay (interval) is equal to or less than what
|
// its delay (interval) is equal to or less than what
|
||||||
|
@ -597,7 +595,7 @@ TimeoutManager::SetTimeout(nsITimeoutHandler* aHandler,
|
||||||
// because our lower bound for |realInterval| could be pretty high
|
// because our lower bound for |realInterval| could be pretty high
|
||||||
// in some cases.
|
// in some cases.
|
||||||
if (interval <= gDisableOpenClickDelay) {
|
if (interval <= gDisableOpenClickDelay) {
|
||||||
timeout->mPopupState = mWindow.GetPopupControlState();
|
timeout->mPopupState = nsContentUtils::GetPopupControlState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,7 +1195,6 @@ public:
|
||||||
explicit ThrottleTimeoutsCallback(nsGlobalWindowInner* aWindow)
|
explicit ThrottleTimeoutsCallback(nsGlobalWindowInner* aWindow)
|
||||||
: mWindow(aWindow)
|
: mWindow(aWindow)
|
||||||
{
|
{
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
#include "WindowDestroyedEvent.h"
|
||||||
|
|
||||||
|
#include "nsJSUtils.h"
|
||||||
|
#include "jsapi.h" // for JSAutoRequest
|
||||||
|
#include "jswrapper.h"
|
||||||
|
#include "nsIPrincipal.h"
|
||||||
|
#include "nsISupportsPrimitives.h"
|
||||||
|
#include "nsIAppStartup.h"
|
||||||
|
#include "nsToolkitCompsCID.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
// Try to match compartments that are not web content by matching compartments
|
||||||
|
// with principals that are either the system principal or an expanded principal.
|
||||||
|
// This may not return true for all non-web-content compartments.
|
||||||
|
struct BrowserCompartmentMatcher : public js::CompartmentFilter {
|
||||||
|
bool match(JSCompartment* aC) const override
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIPrincipal> pc = nsJSPrincipals::get(JS_GetCompartmentPrincipals(aC));
|
||||||
|
return nsContentUtils::IsSystemOrExpandedPrincipal(pc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
WindowDestroyedEvent::WindowDestroyedEvent(nsGlobalWindowInner* aWindow,
|
||||||
|
uint64_t aID, const char* aTopic)
|
||||||
|
: mozilla::Runnable("WindowDestroyedEvent")
|
||||||
|
, mID(aID)
|
||||||
|
, mPhase(Phase::Destroying)
|
||||||
|
, mTopic(aTopic)
|
||||||
|
, mIsInnerWindow(true)
|
||||||
|
{
|
||||||
|
mWindow = do_GetWeakReference(aWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowDestroyedEvent::WindowDestroyedEvent(nsGlobalWindowOuter* aWindow,
|
||||||
|
uint64_t aID, const char* aTopic)
|
||||||
|
: mozilla::Runnable("WindowDestroyedEvent")
|
||||||
|
, mID(aID)
|
||||||
|
, mPhase(Phase::Destroying)
|
||||||
|
, mTopic(aTopic)
|
||||||
|
, mIsInnerWindow(false)
|
||||||
|
{
|
||||||
|
mWindow = do_GetWeakReference(aWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WindowDestroyedEvent::Run()
|
||||||
|
{
|
||||||
|
AUTO_PROFILER_LABEL("WindowDestroyedEvent::Run", OTHER);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
|
services::GetObserverService();
|
||||||
|
if (!observerService) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupportsPRUint64> wrapper =
|
||||||
|
do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID);
|
||||||
|
if (wrapper) {
|
||||||
|
wrapper->SetData(mID);
|
||||||
|
observerService->NotifyObservers(wrapper, mTopic.get(), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (mPhase) {
|
||||||
|
case Phase::Destroying:
|
||||||
|
{
|
||||||
|
bool skipNukeCrossCompartment = false;
|
||||||
|
#ifndef DEBUG
|
||||||
|
nsCOMPtr<nsIAppStartup> appStartup =
|
||||||
|
do_GetService(NS_APPSTARTUP_CONTRACTID);
|
||||||
|
|
||||||
|
if (appStartup) {
|
||||||
|
appStartup->GetShuttingDown(&skipNukeCrossCompartment);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!skipNukeCrossCompartment) {
|
||||||
|
// The compartment nuking phase might be too expensive, so do that
|
||||||
|
// part off of idle dispatch.
|
||||||
|
|
||||||
|
// For the compartment nuking phase, we dispatch either an
|
||||||
|
// inner-window-nuked or an outer-window-nuked notification.
|
||||||
|
// This will allow tests to wait for compartment nuking to happen.
|
||||||
|
if (mTopic.EqualsLiteral("inner-window-destroyed")) {
|
||||||
|
mTopic.AssignLiteral("inner-window-nuked");
|
||||||
|
} else if (mTopic.EqualsLiteral("outer-window-destroyed")) {
|
||||||
|
mTopic.AssignLiteral("outer-window-nuked");
|
||||||
|
}
|
||||||
|
mPhase = Phase::Nuking;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIRunnable> copy(this);
|
||||||
|
NS_IdleDispatchToCurrentThread(copy.forget(), 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Phase::Nuking:
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsISupports> window = do_QueryReferent(mWindow);
|
||||||
|
if (window) {
|
||||||
|
nsGlobalWindowInner* currentInner;
|
||||||
|
if (mIsInnerWindow) {
|
||||||
|
currentInner = nsGlobalWindowInner::FromSupports(window);
|
||||||
|
} else {
|
||||||
|
nsGlobalWindowOuter* outer = nsGlobalWindowOuter::FromSupports(window);
|
||||||
|
currentInner = outer->GetCurrentInnerWindowInternal();
|
||||||
|
}
|
||||||
|
NS_ENSURE_TRUE(currentInner, NS_OK);
|
||||||
|
|
||||||
|
AutoSafeJSContext cx;
|
||||||
|
JS::Rooted<JSObject*> obj(cx, currentInner->FastGetGlobalJSObject());
|
||||||
|
if (obj && !js::IsSystemCompartment(js::GetObjectCompartment(obj))) {
|
||||||
|
JSCompartment* cpt = js::GetObjectCompartment(obj);
|
||||||
|
nsCOMPtr<nsIPrincipal> pc = nsJSPrincipals::get(JS_GetCompartmentPrincipals(cpt));
|
||||||
|
|
||||||
|
if (BasePrincipal::Cast(pc)->AddonPolicy()) {
|
||||||
|
// We want to nuke all references to the add-on compartment.
|
||||||
|
xpc::NukeAllWrappersForCompartment(cx, cpt,
|
||||||
|
mIsInnerWindow ? js::DontNukeWindowReferences
|
||||||
|
: js::NukeWindowReferences);
|
||||||
|
} else {
|
||||||
|
// We only want to nuke wrappers for the chrome->content case
|
||||||
|
js::NukeCrossCompartmentWrappers(cx, BrowserCompartmentMatcher(), cpt,
|
||||||
|
mIsInnerWindow ? js::DontNukeWindowReferences
|
||||||
|
: js::NukeWindowReferences,
|
||||||
|
js::NukeIncomingReferences);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace mozilla
|
|
@ -0,0 +1,43 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef WindowDestroyedEvent_h
|
||||||
|
#define WindowDestroyedEvent_h
|
||||||
|
|
||||||
|
#include "nsGlobalWindow.h"
|
||||||
|
#include "nsThreadUtils.h"
|
||||||
|
#include "nsWeakPtr.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
class WindowDestroyedEvent final : public Runnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WindowDestroyedEvent(nsGlobalWindowInner* aWindow,
|
||||||
|
uint64_t aID, const char* aTopic);
|
||||||
|
WindowDestroyedEvent(nsGlobalWindowOuter* aWindow,
|
||||||
|
uint64_t aID, const char* aTopic);
|
||||||
|
|
||||||
|
enum class Phase
|
||||||
|
{
|
||||||
|
Destroying,
|
||||||
|
Nuking
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_IMETHOD Run() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint64_t mID;
|
||||||
|
Phase mPhase;
|
||||||
|
nsCString mTopic;
|
||||||
|
nsWeakPtr mWindow;
|
||||||
|
bool mIsInnerWindow;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // defined(WindowDestroyedEvent_h)
|
|
@ -21,7 +21,7 @@ WindowOrientationObserver::WindowOrientationObserver(
|
||||||
nsGlobalWindowInner* aGlobalWindow)
|
nsGlobalWindowInner* aGlobalWindow)
|
||||||
: mWindow(aGlobalWindow)
|
: mWindow(aGlobalWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobalWindow && aGlobalWindow->IsInnerWindow());
|
MOZ_ASSERT(aGlobalWindow);
|
||||||
hal::RegisterScreenConfigurationObserver(this);
|
hal::RegisterScreenConfigurationObserver(this);
|
||||||
|
|
||||||
hal::ScreenConfiguration config;
|
hal::ScreenConfiguration config;
|
||||||
|
|
|
@ -363,6 +363,7 @@ UNIFIED_SOURCES += [
|
||||||
'TimeoutManager.cpp',
|
'TimeoutManager.cpp',
|
||||||
'TreeWalker.cpp',
|
'TreeWalker.cpp',
|
||||||
'WebKitCSSMatrix.cpp',
|
'WebKitCSSMatrix.cpp',
|
||||||
|
'WindowDestroyedEvent.cpp',
|
||||||
'WindowNamedPropertiesHandler.cpp',
|
'WindowNamedPropertiesHandler.cpp',
|
||||||
'WindowOrientationObserver.cpp',
|
'WindowOrientationObserver.cpp',
|
||||||
'XPathGenerator.cpp',
|
'XPathGenerator.cpp',
|
||||||
|
@ -388,11 +389,9 @@ SOURCES += [
|
||||||
'nsDOMWindowUtils.cpp',
|
'nsDOMWindowUtils.cpp',
|
||||||
# Conflicts with windows.h's definition of SendMessage.
|
# Conflicts with windows.h's definition of SendMessage.
|
||||||
'nsFrameMessageManager.cpp',
|
'nsFrameMessageManager.cpp',
|
||||||
# This file has a #error "Never include windows.h in this file!"
|
# These files have a #error "Never include windows.h in this file!"
|
||||||
'nsGlobalWindow.cpp',
|
'nsGlobalWindowInner.cpp',
|
||||||
# These files are included by nsGlobalWindow.cpp
|
'nsGlobalWindowOuter.cpp',
|
||||||
# 'nsGlobalWindowInner.cpp',
|
|
||||||
# 'nsGlobalWindowOuter.cpp',
|
|
||||||
# Conflicts with windows.h's definition of LoadImage.
|
# Conflicts with windows.h's definition of LoadImage.
|
||||||
'nsImageLoadingContent.cpp',
|
'nsImageLoadingContent.cpp',
|
||||||
# Because of OS X headers.
|
# Because of OS X headers.
|
||||||
|
|
|
@ -364,7 +364,6 @@ nsContentPermissionUtils::CreateContentPermissionRequestParent(const nsTArray<Pe
|
||||||
nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest,
|
nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest,
|
||||||
nsPIDOMWindowInner* aWindow)
|
nsPIDOMWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!aWindow || aWindow->IsInnerWindow());
|
|
||||||
NS_ENSURE_STATE(aWindow && aWindow->IsCurrentInnerWindow());
|
NS_ENSURE_STATE(aWindow && aWindow->IsCurrentInnerWindow());
|
||||||
|
|
||||||
// for content process
|
// for content process
|
||||||
|
|
|
@ -343,6 +343,11 @@ bool nsContentUtils::sDoNotTrackEnabled = false;
|
||||||
|
|
||||||
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
|
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
|
||||||
|
|
||||||
|
PopupControlState nsContentUtils::sPopupControlState = openAbused;
|
||||||
|
|
||||||
|
int32_t nsContentUtils::sInnerOrOuterWindowCount = 0;
|
||||||
|
uint32_t nsContentUtils::sInnerOrOuterWindowSerialCounter = 0;
|
||||||
|
|
||||||
// Subset of http://www.whatwg.org/specs/web-apps/current-work/#autofill-field-name
|
// Subset of http://www.whatwg.org/specs/web-apps/current-work/#autofill-field-name
|
||||||
enum AutocompleteUnsupportedFieldName : uint8_t
|
enum AutocompleteUnsupportedFieldName : uint8_t
|
||||||
{
|
{
|
||||||
|
@ -9017,8 +9022,6 @@ nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
|
||||||
nsContentUtils::StorageAccess
|
nsContentUtils::StorageAccess
|
||||||
nsContentUtils::StorageAllowedForWindow(nsPIDOMWindowInner* aWindow)
|
nsContentUtils::StorageAllowedForWindow(nsPIDOMWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
if (nsIDocument* document = aWindow->GetExtantDoc()) {
|
if (nsIDocument* document = aWindow->GetExtantDoc()) {
|
||||||
nsCOMPtr<nsIPrincipal> principal = document->NodePrincipal();
|
nsCOMPtr<nsIPrincipal> principal = document->NodePrincipal();
|
||||||
return InternalStorageAllowedForPrincipal(principal, aWindow);
|
return InternalStorageAllowedForPrincipal(principal, aWindow);
|
||||||
|
@ -9107,7 +9110,6 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
|
||||||
nsPIDOMWindowInner* aWindow)
|
nsPIDOMWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aPrincipal);
|
MOZ_ASSERT(aPrincipal);
|
||||||
MOZ_ASSERT(!aWindow || aWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
StorageAccess access = StorageAccess::eAllow;
|
StorageAccess access = StorageAccess::eAllow;
|
||||||
|
|
||||||
|
@ -10974,3 +10976,44 @@ nsContentUtils::DevToolsEnabled(JSContext* aCx)
|
||||||
|
|
||||||
return workerPrivate->DevToolsEnabled();
|
return workerPrivate->DevToolsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ bool
|
||||||
|
nsContentUtils::ContentIsLink(nsIContent* aContent)
|
||||||
|
{
|
||||||
|
return aContent && (aContent->IsHTMLElement(nsGkAtoms::a) ||
|
||||||
|
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||||
|
nsGkAtoms::simple, eCaseMatters));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ already_AddRefed<EventTarget>
|
||||||
|
nsContentUtils::TryGetTabChildGlobalAsEventTarget(nsISupports* aFrom)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner = do_QueryInterface(aFrom);
|
||||||
|
if (!frameLoaderOwner) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
|
||||||
|
if (!frameLoader) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<EventTarget> target = frameLoader->GetTabChildGlobalAsEventTarget();
|
||||||
|
return target.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ uint32_t
|
||||||
|
nsContentUtils::InnerOrOuterWindowCreated()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
++sInnerOrOuterWindowCount;
|
||||||
|
return ++sInnerOrOuterWindowSerialCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ void
|
||||||
|
nsContentUtils::InnerOrOuterWindowDestroyed()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
MOZ_ASSERT(sInnerOrOuterWindowCount > 0);
|
||||||
|
--sInnerOrOuterWindowCount;
|
||||||
|
}
|
||||||
|
|
|
@ -3243,6 +3243,38 @@ public:
|
||||||
|
|
||||||
static void AsyncPrecreateStringBundles();
|
static void AsyncPrecreateStringBundles();
|
||||||
|
|
||||||
|
static bool ContentIsLink(nsIContent* aContent);
|
||||||
|
|
||||||
|
static already_AddRefed<mozilla::dom::EventTarget>
|
||||||
|
TryGetTabChildGlobalAsEventTarget(nsISupports* aFrom);
|
||||||
|
|
||||||
|
static PopupControlState
|
||||||
|
PushPopupControlState(PopupControlState aState, bool aForce)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
PopupControlState old = sPopupControlState;
|
||||||
|
if (aState < old || aForce) {
|
||||||
|
sPopupControlState = aState;
|
||||||
|
}
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PopPopupControlState(PopupControlState aState)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
sPopupControlState = aState;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PopupControlState GetPopupControlState() { return sPopupControlState; }
|
||||||
|
|
||||||
|
// Get a serial number for a newly created inner or outer window.
|
||||||
|
static uint32_t InnerOrOuterWindowCreated();
|
||||||
|
// Record that an inner or outer window has been destroyed.
|
||||||
|
static void InnerOrOuterWindowDestroyed();
|
||||||
|
// Get the current number of inner or outer windows.
|
||||||
|
static int32_t GetCurrentInnerOrOuterWindowCount() { return sInnerOrOuterWindowCount; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool InitializeEventTable();
|
static bool InitializeEventTable();
|
||||||
|
|
||||||
|
@ -3431,6 +3463,11 @@ private:
|
||||||
#endif
|
#endif
|
||||||
static bool sDoNotTrackEnabled;
|
static bool sDoNotTrackEnabled;
|
||||||
static mozilla::LazyLogModule sDOMDumpLog;
|
static mozilla::LazyLogModule sDOMDumpLog;
|
||||||
|
|
||||||
|
static PopupControlState sPopupControlState;
|
||||||
|
|
||||||
|
static int32_t sInnerOrOuterWindowCount;
|
||||||
|
static uint32_t sInnerOrOuterWindowSerialCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* static */ inline
|
/* static */ inline
|
||||||
|
|
|
@ -229,7 +229,6 @@ static inline nsresult
|
||||||
SetParentToWindow(nsGlobalWindowInner *win, JSObject **parent)
|
SetParentToWindow(nsGlobalWindowInner *win, JSObject **parent)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(win);
|
MOZ_ASSERT(win);
|
||||||
MOZ_ASSERT(win->IsInnerWindow());
|
|
||||||
*parent = win->FastGetGlobalJSObject();
|
*parent = win->FastGetGlobalJSObject();
|
||||||
|
|
||||||
if (MOZ_UNLIKELY(!*parent)) {
|
if (MOZ_UNLIKELY(!*parent)) {
|
||||||
|
@ -1029,12 +1028,13 @@ nsDOMConstructor::Create(const char16_t* aName,
|
||||||
nsPIDOMWindowOuter* outerWindow = aOwner->GetOuterWindow();
|
nsPIDOMWindowOuter* outerWindow = aOwner->GetOuterWindow();
|
||||||
nsPIDOMWindowInner* currentInner =
|
nsPIDOMWindowInner* currentInner =
|
||||||
outerWindow ? outerWindow->GetCurrentInnerWindow() : aOwner;
|
outerWindow ? outerWindow->GetCurrentInnerWindow() : aOwner;
|
||||||
if (!currentInner ||
|
if (!currentInner) {
|
||||||
(aOwner != currentInner &&
|
|
||||||
!nsContentUtils::CanCallerAccess(currentInner) &&
|
|
||||||
!(currentInner = aOwner)->IsInnerWindow())) {
|
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
}
|
}
|
||||||
|
if (aOwner != currentInner &&
|
||||||
|
!nsContentUtils::CanCallerAccess(currentInner)) {
|
||||||
|
currentInner = aOwner;
|
||||||
|
}
|
||||||
|
|
||||||
bool constructable = aNameStruct && IsConstructable(aNameStruct);
|
bool constructable = aNameStruct && IsConstructable(aNameStruct);
|
||||||
|
|
||||||
|
|
|
@ -816,7 +816,6 @@ nsDOMMutationObserver::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(window->IsInnerWindow());
|
|
||||||
bool isChrome = nsContentUtils::IsChromeDoc(window->GetExtantDoc());
|
bool isChrome = nsContentUtils::IsChromeDoc(window->GetExtantDoc());
|
||||||
RefPtr<nsDOMMutationObserver> observer =
|
RefPtr<nsDOMMutationObserver> observer =
|
||||||
new nsDOMMutationObserver(window.forget(), aCb, isChrome);
|
new nsDOMMutationObserver(window.forget(), aCb, isChrome);
|
||||||
|
|
|
@ -212,7 +212,6 @@ nsDOMWindowUtils::nsDOMWindowUtils(nsGlobalWindowOuter *aWindow)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISupports> supports = do_QueryObject(aWindow);
|
nsCOMPtr<nsISupports> supports = do_QueryObject(aWindow);
|
||||||
mWindow = do_GetWeakReference(supports);
|
mWindow = do_GetWeakReference(supports);
|
||||||
NS_ASSERTION(aWindow->IsOuterWindow(), "How did that happen?");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMWindowUtils::~nsDOMWindowUtils()
|
nsDOMWindowUtils::~nsDOMWindowUtils()
|
||||||
|
@ -2390,7 +2389,6 @@ nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
|
||||||
NS_ENSURE_STATE(window);
|
NS_ENSURE_STATE(window);
|
||||||
|
|
||||||
NS_ASSERTION(window->IsOuterWindow(), "How did that happen?");
|
|
||||||
*aWindowID = window->WindowID();
|
*aWindowID = window->WindowID();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -2401,7 +2399,6 @@ nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t *aWindowID)
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
|
||||||
NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
|
||||||
|
|
||||||
NS_ASSERTION(window->IsOuterWindow(), "How did that happen?");
|
|
||||||
nsGlobalWindowInner* inner =
|
nsGlobalWindowInner* inner =
|
||||||
nsGlobalWindowOuter::Cast(window)->GetCurrentInnerWindowInternal();
|
nsGlobalWindowOuter::Cast(window)->GetCurrentInnerWindowInternal();
|
||||||
if (!inner) {
|
if (!inner) {
|
||||||
|
|
|
@ -1538,6 +1538,7 @@ nsIDocument::nsIDocument()
|
||||||
mDidCallBeginLoad(false),
|
mDidCallBeginLoad(false),
|
||||||
mBufferingCSPViolations(false),
|
mBufferingCSPViolations(false),
|
||||||
mAllowPaymentRequest(false),
|
mAllowPaymentRequest(false),
|
||||||
|
mEncodingMenuDisabled(false),
|
||||||
mIsScopedStyleEnabled(eScopedStyle_Unknown),
|
mIsScopedStyleEnabled(eScopedStyle_Unknown),
|
||||||
mCompatMode(eCompatibility_FullStandards),
|
mCompatMode(eCompatibility_FullStandards),
|
||||||
mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
|
mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
|
||||||
|
@ -5063,14 +5064,6 @@ nsIDocument::GetContainer() const
|
||||||
void
|
void
|
||||||
nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(aScriptGlobalObject));
|
|
||||||
|
|
||||||
NS_ASSERTION(!win || win->IsInnerWindow(),
|
|
||||||
"Script global object must be an inner window!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
MOZ_ASSERT(aScriptGlobalObject || !mAnimationController ||
|
MOZ_ASSERT(aScriptGlobalObject || !mAnimationController ||
|
||||||
mAnimationController->IsPausedByType(
|
mAnimationController->IsPausedByType(
|
||||||
nsSMILTimeContainer::PAUSE_PAGEHIDE |
|
nsSMILTimeContainer::PAUSE_PAGEHIDE |
|
||||||
|
@ -10889,7 +10882,6 @@ nsIDocument::CreateTouch(nsGlobalWindowInner* aView,
|
||||||
float aRotationAngle,
|
float aRotationAngle,
|
||||||
float aForce)
|
float aForce)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT_IF(aView, aView->IsInnerWindow());
|
|
||||||
RefPtr<Touch> touch = new Touch(aTarget,
|
RefPtr<Touch> touch = new Touch(aTarget,
|
||||||
aIdentifier,
|
aIdentifier,
|
||||||
aPageX, aPageY,
|
aPageX, aPageY,
|
||||||
|
@ -14380,7 +14372,6 @@ nsIDocument::GetSelection(ErrorResult& aRv)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(window->IsInnerWindow(), "Should have inner window here!");
|
|
||||||
if (!window->IsCurrentInnerWindow()) {
|
if (!window->IsCurrentInnerWindow()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1038,7 +1038,6 @@ nsFocusManager::WindowHidden(mozIDOMWindowProxy* aWindow)
|
||||||
// not happen if nsIAppStartup::eForceQuit is used to quit, and can cause
|
// not happen if nsIAppStartup::eForceQuit is used to quit, and can cause
|
||||||
// a leak. So if the active window is being destroyed, call WindowLowered
|
// a leak. So if the active window is being destroyed, call WindowLowered
|
||||||
// directly.
|
// directly.
|
||||||
NS_ASSERTION(mFocusedWindow->IsOuterWindow(), "outer window expected");
|
|
||||||
if (mActiveWindow == mFocusedWindow || mActiveWindow == window)
|
if (mActiveWindow == mFocusedWindow || mActiveWindow == window)
|
||||||
WindowLowered(mActiveWindow);
|
WindowLowered(mActiveWindow);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,832 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsGlobalWindow.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include "mozilla/MemoryReporting.h"
|
|
||||||
|
|
||||||
// Local Includes
|
|
||||||
#include "Navigator.h"
|
|
||||||
#include "nsContentSecurityManager.h"
|
|
||||||
#include "nsScreen.h"
|
|
||||||
#include "nsHistory.h"
|
|
||||||
#include "nsDOMNavigationTiming.h"
|
|
||||||
#include "nsIDOMStorageManager.h"
|
|
||||||
#include "mozilla/dom/LocalStorage.h"
|
|
||||||
#include "mozilla/dom/Storage.h"
|
|
||||||
#include "mozilla/dom/IdleRequest.h"
|
|
||||||
#include "mozilla/dom/Performance.h"
|
|
||||||
#include "mozilla/dom/StorageEvent.h"
|
|
||||||
#include "mozilla/dom/StorageEventBinding.h"
|
|
||||||
#include "mozilla/dom/StorageNotifierService.h"
|
|
||||||
#include "mozilla/dom/StorageUtils.h"
|
|
||||||
#include "mozilla/dom/Timeout.h"
|
|
||||||
#include "mozilla/dom/TimeoutHandler.h"
|
|
||||||
#include "mozilla/dom/TimeoutManager.h"
|
|
||||||
#include "mozilla/IntegerPrintfMacros.h"
|
|
||||||
#if defined(MOZ_WIDGET_ANDROID)
|
|
||||||
#include "mozilla/dom/WindowOrientationObserver.h"
|
|
||||||
#endif
|
|
||||||
#include "nsDOMOfflineResourceList.h"
|
|
||||||
#include "nsError.h"
|
|
||||||
#include "nsIIdleService.h"
|
|
||||||
#include "nsISizeOfEventTarget.h"
|
|
||||||
#include "nsDOMJSUtils.h"
|
|
||||||
#include "nsArrayUtils.h"
|
|
||||||
#include "nsIDOMWindowCollection.h"
|
|
||||||
#include "nsDOMWindowList.h"
|
|
||||||
#include "mozilla/dom/WakeLock.h"
|
|
||||||
#include "mozilla/dom/power/PowerManagerService.h"
|
|
||||||
#include "nsIDocShellTreeOwner.h"
|
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
|
||||||
#include "nsIPermissionManager.h"
|
|
||||||
#include "nsIScriptContext.h"
|
|
||||||
#include "nsIScriptTimeoutHandler.h"
|
|
||||||
#include "nsITimeoutHandler.h"
|
|
||||||
#include "nsIController.h"
|
|
||||||
#include "nsScriptNameSpaceManager.h"
|
|
||||||
#include "nsISlowScriptDebug.h"
|
|
||||||
#include "nsWindowMemoryReporter.h"
|
|
||||||
#include "nsWindowSizes.h"
|
|
||||||
#include "WindowNamedPropertiesHandler.h"
|
|
||||||
#include "nsFrameSelection.h"
|
|
||||||
#include "nsNetUtil.h"
|
|
||||||
#include "nsVariant.h"
|
|
||||||
#include "nsPrintfCString.h"
|
|
||||||
#include "mozilla/intl/LocaleService.h"
|
|
||||||
|
|
||||||
// Helper Classes
|
|
||||||
#include "nsJSUtils.h"
|
|
||||||
#include "jsapi.h" // for JSAutoRequest
|
|
||||||
#include "jswrapper.h"
|
|
||||||
#include "nsCharSeparatedTokenizer.h"
|
|
||||||
#include "nsReadableUtils.h"
|
|
||||||
#include "nsDOMClassInfo.h"
|
|
||||||
#include "nsJSEnvironment.h"
|
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
#include "mozilla/Likely.h"
|
|
||||||
#include "mozilla/Sprintf.h"
|
|
||||||
#include "mozilla/Unused.h"
|
|
||||||
|
|
||||||
// Other Classes
|
|
||||||
#include "mozilla/dom/BarProps.h"
|
|
||||||
#include "nsContentCID.h"
|
|
||||||
#include "nsLayoutStatics.h"
|
|
||||||
#include "nsCCUncollectableMarker.h"
|
|
||||||
#include "mozilla/dom/workers/Workers.h"
|
|
||||||
#include "mozilla/dom/ToJSValue.h"
|
|
||||||
#include "nsJSPrincipals.h"
|
|
||||||
#include "mozilla/Attributes.h"
|
|
||||||
#include "mozilla/Debug.h"
|
|
||||||
#include "mozilla/EventListenerManager.h"
|
|
||||||
#include "mozilla/EventStates.h"
|
|
||||||
#include "mozilla/MouseEvents.h"
|
|
||||||
#include "mozilla/ProcessHangMonitor.h"
|
|
||||||
#include "mozilla/ThrottledEventQueue.h"
|
|
||||||
#include "AudioChannelService.h"
|
|
||||||
#include "nsAboutProtocolUtils.h"
|
|
||||||
#include "nsCharTraits.h" // NS_IS_HIGH/LOW_SURROGATE
|
|
||||||
#include "PostMessageEvent.h"
|
|
||||||
#include "mozilla/dom/DocGroup.h"
|
|
||||||
#include "mozilla/dom/TabGroup.h"
|
|
||||||
|
|
||||||
// Interfaces Needed
|
|
||||||
#include "nsIFrame.h"
|
|
||||||
#include "nsCanvasFrame.h"
|
|
||||||
#include "nsIWidget.h"
|
|
||||||
#include "nsIWidgetListener.h"
|
|
||||||
#include "nsIBaseWindow.h"
|
|
||||||
#include "nsIDeviceSensors.h"
|
|
||||||
#include "nsIContent.h"
|
|
||||||
#include "nsIDocShell.h"
|
|
||||||
#include "nsIDocCharset.h"
|
|
||||||
#include "nsIDocument.h"
|
|
||||||
#include "Crypto.h"
|
|
||||||
#include "nsIDOMDocument.h"
|
|
||||||
#include "nsIDOMElement.h"
|
|
||||||
#include "nsIDOMEvent.h"
|
|
||||||
#include "nsIDOMOfflineResourceList.h"
|
|
||||||
#include "nsDOMString.h"
|
|
||||||
#include "nsIEmbeddingSiteWindow.h"
|
|
||||||
#include "nsThreadUtils.h"
|
|
||||||
#include "nsILoadContext.h"
|
|
||||||
#include "nsIPresShell.h"
|
|
||||||
#include "nsIScrollableFrame.h"
|
|
||||||
#include "nsView.h"
|
|
||||||
#include "nsViewManager.h"
|
|
||||||
#include "nsISelectionController.h"
|
|
||||||
#include "nsISelection.h"
|
|
||||||
#include "nsIPrompt.h"
|
|
||||||
#include "nsIPromptService.h"
|
|
||||||
#include "nsIPromptFactory.h"
|
|
||||||
#include "nsIAddonPolicyService.h"
|
|
||||||
#include "nsIWritablePropertyBag2.h"
|
|
||||||
#include "nsIWebNavigation.h"
|
|
||||||
#include "nsIWebBrowserChrome.h"
|
|
||||||
#include "nsIWebBrowserFind.h" // For window.find()
|
|
||||||
#include "nsIWindowMediator.h" // For window.find()
|
|
||||||
#include "nsComputedDOMStyle.h"
|
|
||||||
#include "nsDOMCID.h"
|
|
||||||
#include "nsDOMWindowUtils.h"
|
|
||||||
#include "nsIWindowWatcher.h"
|
|
||||||
#include "nsPIWindowWatcher.h"
|
|
||||||
#include "nsIContentViewer.h"
|
|
||||||
#include "nsIScriptError.h"
|
|
||||||
#include "nsIControllers.h"
|
|
||||||
#include "nsIControllerContext.h"
|
|
||||||
#include "nsGlobalWindowCommands.h"
|
|
||||||
#include "nsQueryObject.h"
|
|
||||||
#include "nsContentUtils.h"
|
|
||||||
#include "nsCSSProps.h"
|
|
||||||
#include "nsIDOMFileList.h"
|
|
||||||
#include "nsIURIFixup.h"
|
|
||||||
#ifndef DEBUG
|
|
||||||
#include "nsIAppStartup.h"
|
|
||||||
#include "nsToolkitCompsCID.h"
|
|
||||||
#endif
|
|
||||||
#include "nsCDefaultURIFixup.h"
|
|
||||||
#include "mozilla/EventDispatcher.h"
|
|
||||||
#include "mozilla/EventStateManager.h"
|
|
||||||
#include "nsIObserverService.h"
|
|
||||||
#include "nsFocusManager.h"
|
|
||||||
#include "nsIXULWindow.h"
|
|
||||||
#include "nsITimedChannel.h"
|
|
||||||
#include "nsServiceManagerUtils.h"
|
|
||||||
#ifdef MOZ_XUL
|
|
||||||
#include "nsIDOMXULControlElement.h"
|
|
||||||
#include "nsMenuPopupFrame.h"
|
|
||||||
#endif
|
|
||||||
#include "mozilla/dom/CustomEvent.h"
|
|
||||||
#include "nsIJARChannel.h"
|
|
||||||
#include "nsIScreenManager.h"
|
|
||||||
#include "nsIEffectiveTLDService.h"
|
|
||||||
|
|
||||||
#include "xpcprivate.h"
|
|
||||||
|
|
||||||
#ifdef NS_PRINTING
|
|
||||||
#include "nsIPrintSettings.h"
|
|
||||||
#include "nsIPrintSettingsService.h"
|
|
||||||
#include "nsIWebBrowserPrint.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsWindowRoot.h"
|
|
||||||
#include "nsNetCID.h"
|
|
||||||
#include "nsIArray.h"
|
|
||||||
|
|
||||||
// XXX An unfortunate dependency exists here (two XUL files).
|
|
||||||
#include "nsIDOMXULDocument.h"
|
|
||||||
#include "nsIDOMXULCommandDispatcher.h"
|
|
||||||
|
|
||||||
#include "nsBindingManager.h"
|
|
||||||
#include "nsXBLService.h"
|
|
||||||
|
|
||||||
// used for popup blocking, needs to be converted to something
|
|
||||||
// belonging to the back-end like nsIContentPolicy
|
|
||||||
#include "nsIPopupWindowManager.h"
|
|
||||||
|
|
||||||
#include "nsIDragService.h"
|
|
||||||
#include "mozilla/dom/Element.h"
|
|
||||||
#include "mozilla/dom/Selection.h"
|
|
||||||
#include "nsFrameLoader.h"
|
|
||||||
#include "nsISupportsPrimitives.h"
|
|
||||||
#include "nsXPCOMCID.h"
|
|
||||||
#include "mozilla/Logging.h"
|
|
||||||
#include "prenv.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/IDBFactory.h"
|
|
||||||
#include "mozilla/dom/MessageChannel.h"
|
|
||||||
#include "mozilla/dom/Promise.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/Gamepad.h"
|
|
||||||
#include "mozilla/dom/GamepadManager.h"
|
|
||||||
|
|
||||||
#include "gfxVR.h"
|
|
||||||
#include "mozilla/dom/VRDisplay.h"
|
|
||||||
#include "mozilla/dom/VRDisplayEvent.h"
|
|
||||||
#include "mozilla/dom/VRDisplayEventBinding.h"
|
|
||||||
#include "mozilla/dom/VREventObserver.h"
|
|
||||||
|
|
||||||
#include "nsRefreshDriver.h"
|
|
||||||
#include "Layers.h"
|
|
||||||
|
|
||||||
#include "mozilla/AddonPathService.h"
|
|
||||||
#include "mozilla/BasePrincipal.h"
|
|
||||||
#include "mozilla/Services.h"
|
|
||||||
#include "mozilla/Telemetry.h"
|
|
||||||
#include "mozilla/dom/Location.h"
|
|
||||||
#include "nsHTMLDocument.h"
|
|
||||||
#include "nsWrapperCacheInlines.h"
|
|
||||||
#include "mozilla/DOMEventTargetHelper.h"
|
|
||||||
#include "prrng.h"
|
|
||||||
#include "nsSandboxFlags.h"
|
|
||||||
#include "TimeChangeObserver.h"
|
|
||||||
#include "mozilla/dom/AudioContext.h"
|
|
||||||
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
|
|
||||||
#include "mozilla/dom/cache/CacheStorage.h"
|
|
||||||
#include "mozilla/dom/Console.h"
|
|
||||||
#include "mozilla/dom/Fetch.h"
|
|
||||||
#include "mozilla/dom/FunctionBinding.h"
|
|
||||||
#include "mozilla/dom/HashChangeEvent.h"
|
|
||||||
#include "mozilla/dom/IntlUtils.h"
|
|
||||||
#include "mozilla/dom/MozSelfSupportBinding.h"
|
|
||||||
#include "mozilla/dom/PopStateEvent.h"
|
|
||||||
#include "mozilla/dom/PopupBlockedEvent.h"
|
|
||||||
#include "mozilla/dom/PrimitiveConversions.h"
|
|
||||||
#include "mozilla/dom/WindowBinding.h"
|
|
||||||
#include "nsITabChild.h"
|
|
||||||
#include "mozilla/dom/MediaQueryList.h"
|
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
|
||||||
#include "mozilla/dom/NavigatorBinding.h"
|
|
||||||
#include "mozilla/dom/ImageBitmap.h"
|
|
||||||
#include "mozilla/dom/ImageBitmapBinding.h"
|
|
||||||
#include "mozilla/dom/ServiceWorkerRegistration.h"
|
|
||||||
#include "mozilla/dom/U2F.h"
|
|
||||||
#include "mozilla/dom/WebIDLGlobalNameHash.h"
|
|
||||||
#include "mozilla/dom/Worklet.h"
|
|
||||||
#ifdef HAVE_SIDEBAR
|
|
||||||
#include "mozilla/dom/ExternalBinding.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MOZ_WEBSPEECH
|
|
||||||
#include "mozilla/dom/SpeechSynthesis.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Apple system headers seem to have a check() macro. <sigh>
|
|
||||||
#ifdef check
|
|
||||||
class nsIScriptTimeoutHandler;
|
|
||||||
#undef check
|
|
||||||
#endif // check
|
|
||||||
#include "AccessCheck.h"
|
|
||||||
|
|
||||||
#ifdef ANDROID
|
|
||||||
#include <android/log.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XP_WIN
|
|
||||||
#include <process.h>
|
|
||||||
#define getpid _getpid
|
|
||||||
#else
|
|
||||||
#include <unistd.h> // for getpid()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char kStorageEnabled[] = "dom.storage.enabled";
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
using namespace mozilla::dom::ipc;
|
|
||||||
using mozilla::BasePrincipal;
|
|
||||||
using mozilla::OriginAttributes;
|
|
||||||
using mozilla::TimeStamp;
|
|
||||||
using mozilla::TimeDuration;
|
|
||||||
using mozilla::dom::cache::CacheStorage;
|
|
||||||
|
|
||||||
static LazyLogModule gDOMLeakPRLog("DOMLeak");
|
|
||||||
|
|
||||||
static int32_t gRefCnt = 0;
|
|
||||||
static int32_t gOpenPopupSpamCount = 0;
|
|
||||||
static PopupControlState gPopupControlState = openAbused;
|
|
||||||
static bool gMouseDown = false;
|
|
||||||
static bool gDragServiceDisabled = false;
|
|
||||||
static FILE *gDumpFile = nullptr;
|
|
||||||
static uint32_t gSerialCounter = 0;
|
|
||||||
static bool gIdleObserversAPIFuzzTimeDisabled = false;
|
|
||||||
|
|
||||||
#ifdef DEBUG_jst
|
|
||||||
int32_t gTimeoutCnt = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DEBUG_bryner) || defined(DEBUG_chb)
|
|
||||||
#define DEBUG_PAGE_CACHE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DOM_TOUCH_LISTENER_ADDED "dom-touch-listener-added"
|
|
||||||
|
|
||||||
#define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure"
|
|
||||||
|
|
||||||
// The interval at which we execute idle callbacks
|
|
||||||
static uint32_t gThrottledIdlePeriodLength;
|
|
||||||
|
|
||||||
#define DEFAULT_THROTTLED_IDLE_PERIOD_LENGTH 10000
|
|
||||||
|
|
||||||
// CIDs
|
|
||||||
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
|
|
||||||
|
|
||||||
#define NETWORK_UPLOAD_EVENT_NAME NS_LITERAL_STRING("moznetworkupload")
|
|
||||||
#define NETWORK_DOWNLOAD_EVENT_NAME NS_LITERAL_STRING("moznetworkdownload")
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
extern uint64_t
|
|
||||||
NextWindowID();
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
|
|
||||||
: mFrameElement(nullptr), mDocShell(nullptr), mModalStateDepth(0),
|
|
||||||
mMutationBits(0), mActivePeerConnections(0), mIsDocumentLoaded(false),
|
|
||||||
mIsHandlingResizeEvent(false), mIsInnerWindow(aOuterWindow != nullptr),
|
|
||||||
mMayHavePaintEventListener(false), mMayHaveTouchEventListener(false),
|
|
||||||
mMayHaveSelectionChangeEventListener(false),
|
|
||||||
mMayHaveMouseEnterLeaveEventListener(false),
|
|
||||||
mMayHavePointerEnterLeaveEventListener(false),
|
|
||||||
mInnerObjectsFreed(false),
|
|
||||||
mIsActive(false), mIsBackground(false),
|
|
||||||
mMediaSuspend(
|
|
||||||
Preferences::GetBool("media.block-autoplay-until-in-foreground", true) &&
|
|
||||||
Preferences::GetBool("media.autoplay.enabled", true) ?
|
|
||||||
nsISuspendedTypes::SUSPENDED_BLOCK : nsISuspendedTypes::NONE_SUSPENDED),
|
|
||||||
mAudioMuted(false), mAudioVolume(1.0), mAudioCaptured(false),
|
|
||||||
mDesktopModeViewport(false), mIsRootOuterWindow(false), mInnerWindow(nullptr),
|
|
||||||
mOuterWindow(aOuterWindow),
|
|
||||||
// Make sure no actual window ends up with mWindowID == 0
|
|
||||||
mWindowID(NextWindowID()), mHasNotifiedGlobalCreated(false),
|
|
||||||
mMarkedCCGeneration(0), mServiceWorkersTestingEnabled(false),
|
|
||||||
mLargeAllocStatus(LargeAllocStatus::NONE),
|
|
||||||
mHasTriedToCacheTopInnerWindow(false),
|
|
||||||
mNumOfIndexedDBDatabases(0),
|
|
||||||
mNumOfOpenWebSockets(0)
|
|
||||||
{
|
|
||||||
if (aOuterWindow) {
|
|
||||||
mTimeoutManager =
|
|
||||||
MakeUnique<mozilla::dom::TimeoutManager>(*nsGlobalWindowInner::Cast(AsInner()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
nsPIDOMWindow<T>::~nsPIDOMWindow() {}
|
|
||||||
|
|
||||||
PopupControlState
|
|
||||||
PushPopupControlState(PopupControlState aState, bool aForce)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
PopupControlState oldState = gPopupControlState;
|
|
||||||
|
|
||||||
if (aState < gPopupControlState || aForce) {
|
|
||||||
gPopupControlState = aState;
|
|
||||||
}
|
|
||||||
|
|
||||||
return oldState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PopPopupControlState(PopupControlState aState)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
gPopupControlState = aState;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We need certain special behavior for remote XUL whitelisted domains, but we
|
|
||||||
// don't want that behavior to take effect in automation, because we whitelist
|
|
||||||
// all the mochitest domains. So we need to check a pref here.
|
|
||||||
static bool
|
|
||||||
TreatAsRemoteXUL(nsIPrincipal* aPrincipal)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(aPrincipal));
|
|
||||||
return nsContentUtils::AllowXULXBLForPrincipal(aPrincipal) &&
|
|
||||||
!Preferences::GetBool("dom.use_xbl_scopes_for_remote_xul", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
EnablePrivilege(JSContext* cx, unsigned argc, JS::Value* vp)
|
|
||||||
{
|
|
||||||
Telemetry::Accumulate(Telemetry::ENABLE_PRIVILEGE_EVER_CALLED, true);
|
|
||||||
return xpc::EnableUniversalXPConnect(cx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const JSFunctionSpec EnablePrivilegeSpec[] = {
|
|
||||||
JS_FN("enablePrivilege", EnablePrivilege, 1, 0),
|
|
||||||
JS_FS_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool
|
|
||||||
InitializeLegacyNetscapeObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
|
||||||
{
|
|
||||||
JSAutoCompartment ac(aCx, aGlobal);
|
|
||||||
|
|
||||||
// Note: MathJax depends on window.netscape being exposed. See bug 791526.
|
|
||||||
JS::Rooted<JSObject*> obj(aCx);
|
|
||||||
obj = JS_DefineObject(aCx, aGlobal, "netscape", nullptr);
|
|
||||||
NS_ENSURE_TRUE(obj, false);
|
|
||||||
|
|
||||||
obj = JS_DefineObject(aCx, obj, "security", nullptr);
|
|
||||||
NS_ENSURE_TRUE(obj, false);
|
|
||||||
|
|
||||||
// We hide enablePrivilege behind a pref because it has been altered in a
|
|
||||||
// way that makes it fundamentally insecure to use in production. Mozilla
|
|
||||||
// uses this pref during automated testing to support legacy test code that
|
|
||||||
// uses enablePrivilege. If you're not doing test automation, you _must_ not
|
|
||||||
// flip this pref, or you will be exposing all your users to security
|
|
||||||
// vulnerabilities.
|
|
||||||
if (!xpc::IsInAutomation()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Define PrivilegeManager object with the necessary "static" methods. */
|
|
||||||
obj = JS_DefineObject(aCx, obj, "PrivilegeManager", nullptr);
|
|
||||||
NS_ENSURE_TRUE(obj, false);
|
|
||||||
|
|
||||||
return JS_DefineFunctions(aCx, obj, EnablePrivilegeSpec);
|
|
||||||
}
|
|
||||||
|
|
||||||
static JS::CompartmentCreationOptions&
|
|
||||||
SelectZoneGroup(nsGlobalWindowInner* aNewInner,
|
|
||||||
JS::CompartmentCreationOptions& aOptions)
|
|
||||||
{
|
|
||||||
JS::CompartmentCreationOptions options;
|
|
||||||
|
|
||||||
if (aNewInner->GetOuterWindow()) {
|
|
||||||
nsGlobalWindowOuter *top = aNewInner->GetTopInternal();
|
|
||||||
|
|
||||||
// If we have a top-level window, use its zone (and zone group).
|
|
||||||
if (top && top->GetGlobalJSObject()) {
|
|
||||||
return aOptions.setExistingZone(top->GetGlobalJSObject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're in the parent process, don't bother with zone groups.
|
|
||||||
if (XRE_IsParentProcess()) {
|
|
||||||
return aOptions.setNewZoneInSystemZoneGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, find a zone group from the TabGroup. Typically we only have to
|
|
||||||
// go through one iteration of this loop.
|
|
||||||
RefPtr<TabGroup> tabGroup = aNewInner->TabGroup();
|
|
||||||
for (nsPIDOMWindowOuter* outer : tabGroup->GetWindows()) {
|
|
||||||
nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(outer);
|
|
||||||
if (JSObject* global = window->GetGlobalJSObject()) {
|
|
||||||
return aOptions.setNewZoneInExistingZoneGroup(global);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return aOptions.setNewZoneInNewZoneGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new global object that will be used for an inner window.
|
|
||||||
* Return the native global and an nsISupports 'holder' that can be used
|
|
||||||
* to manage the lifetime of it.
|
|
||||||
*/
|
|
||||||
static nsresult
|
|
||||||
CreateNativeGlobalForInner(JSContext* aCx,
|
|
||||||
nsGlobalWindowInner* aNewInner,
|
|
||||||
nsIURI* aURI,
|
|
||||||
nsIPrincipal* aPrincipal,
|
|
||||||
JS::MutableHandle<JSObject*> aGlobal,
|
|
||||||
bool aIsSecureContext)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aCx);
|
|
||||||
MOZ_ASSERT(aNewInner);
|
|
||||||
MOZ_ASSERT(aNewInner->IsInnerWindow());
|
|
||||||
MOZ_ASSERT(aPrincipal);
|
|
||||||
|
|
||||||
// DOMWindow with nsEP is not supported, we have to make sure
|
|
||||||
// no one creates one accidentally.
|
|
||||||
nsCOMPtr<nsIExpandedPrincipal> nsEP = do_QueryInterface(aPrincipal);
|
|
||||||
MOZ_RELEASE_ASSERT(!nsEP, "DOMWindow with nsEP is not supported");
|
|
||||||
|
|
||||||
JS::CompartmentOptions options;
|
|
||||||
|
|
||||||
SelectZoneGroup(aNewInner, options.creationOptions());
|
|
||||||
|
|
||||||
// Sometimes add-ons load their own XUL windows, either as separate top-level
|
|
||||||
// windows or inside a browser element. In such cases we want to tag the
|
|
||||||
// window's compartment with the add-on ID. See bug 1092156.
|
|
||||||
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
|
||||||
options.creationOptions().setAddonId(MapURIToAddonID(aURI));
|
|
||||||
}
|
|
||||||
|
|
||||||
options.creationOptions().setSecureContext(aIsSecureContext);
|
|
||||||
|
|
||||||
xpc::InitGlobalObjectOptions(options, aPrincipal);
|
|
||||||
|
|
||||||
// Determine if we need the Components object.
|
|
||||||
bool needComponents = nsContentUtils::IsSystemPrincipal(aPrincipal) ||
|
|
||||||
TreatAsRemoteXUL(aPrincipal);
|
|
||||||
uint32_t flags = needComponents ? 0 : xpc::OMIT_COMPONENTS_OBJECT;
|
|
||||||
flags |= xpc::DONT_FIRE_ONNEWGLOBALHOOK;
|
|
||||||
|
|
||||||
if (!WindowBinding::Wrap(aCx, aNewInner, aNewInner, options,
|
|
||||||
nsJSPrincipals::get(aPrincipal), false, aGlobal) ||
|
|
||||||
!xpc::InitGlobalObject(aCx, aGlobal, flags)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_ASSERT(aNewInner->GetWrapperPreserveColor() == aGlobal);
|
|
||||||
|
|
||||||
// Set the location information for the new global, so that tools like
|
|
||||||
// about:memory may use that information
|
|
||||||
xpc::SetLocationForGlobal(aGlobal, aURI);
|
|
||||||
|
|
||||||
if (!InitializeLegacyNetscapeObject(aCx, aGlobal)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
already_AddRefed<EventTarget>
|
|
||||||
TryGetTabChildGlobalAsEventTarget(nsISupports *aFrom)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner = do_QueryInterface(aFrom);
|
|
||||||
if (!frameLoaderOwner) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
|
|
||||||
if (!frameLoader) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<EventTarget> target = frameLoader->GetTabChildGlobalAsEventTarget();
|
|
||||||
return target.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
nsIURI*
|
|
||||||
nsPIDOMWindow<T>::GetDocumentURI() const
|
|
||||||
{
|
|
||||||
return mDoc ? mDoc->GetDocumentURI() : mDocumentURI.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
nsIURI*
|
|
||||||
nsPIDOMWindow<T>::GetDocBaseURI() const
|
|
||||||
{
|
|
||||||
return mDoc ? mDoc->GetDocBaseURI() : mDocBaseURI.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void
|
|
||||||
nsPIDOMWindow<T>::MaybeCreateDoc()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mDoc);
|
|
||||||
if (nsIDocShell* docShell = GetDocShell()) {
|
|
||||||
// Note that |document| here is the same thing as our mDoc, but we
|
|
||||||
// don't have to explicitly set the member variable because the docshell
|
|
||||||
// has already called SetNewDocument().
|
|
||||||
nsCOMPtr<nsIDocument> document = docShell->GetDocument();
|
|
||||||
Unused << document;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to match compartments that are not web content by matching compartments
|
|
||||||
// with principals that are either the system principal or an expanded principal.
|
|
||||||
// This may not return true for all non-web-content compartments.
|
|
||||||
struct BrowserCompartmentMatcher : public js::CompartmentFilter {
|
|
||||||
bool match(JSCompartment* aC) const override
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIPrincipal> pc = nsJSPrincipals::get(JS_GetCompartmentPrincipals(aC));
|
|
||||||
return nsContentUtils::IsSystemOrExpandedPrincipal(pc);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class WindowDestroyedEvent final : public Runnable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WindowDestroyedEvent(nsGlobalWindowInner* aWindow, uint64_t aID, const char* aTopic)
|
|
||||||
: mozilla::Runnable("WindowDestroyedEvent")
|
|
||||||
, mID(aID)
|
|
||||||
, mPhase(Phase::Destroying)
|
|
||||||
, mTopic(aTopic)
|
|
||||||
, mIsInnerWindow(true)
|
|
||||||
{
|
|
||||||
mWindow = do_GetWeakReference(aWindow);
|
|
||||||
}
|
|
||||||
WindowDestroyedEvent(nsGlobalWindowOuter* aWindow, uint64_t aID, const char* aTopic)
|
|
||||||
: mozilla::Runnable("WindowDestroyedEvent")
|
|
||||||
, mID(aID)
|
|
||||||
, mPhase(Phase::Destroying)
|
|
||||||
, mTopic(aTopic)
|
|
||||||
, mIsInnerWindow(false)
|
|
||||||
{
|
|
||||||
mWindow = do_GetWeakReference(aWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class Phase
|
|
||||||
{
|
|
||||||
Destroying,
|
|
||||||
Nuking
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMETHOD Run() override
|
|
||||||
{
|
|
||||||
AUTO_PROFILER_LABEL("WindowDestroyedEvent::Run", OTHER);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> observerService =
|
|
||||||
services::GetObserverService();
|
|
||||||
if (!observerService) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupportsPRUint64> wrapper =
|
|
||||||
do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID);
|
|
||||||
if (wrapper) {
|
|
||||||
wrapper->SetData(mID);
|
|
||||||
observerService->NotifyObservers(wrapper, mTopic.get(), nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (mPhase) {
|
|
||||||
case Phase::Destroying:
|
|
||||||
{
|
|
||||||
bool skipNukeCrossCompartment = false;
|
|
||||||
#ifndef DEBUG
|
|
||||||
nsCOMPtr<nsIAppStartup> appStartup =
|
|
||||||
do_GetService(NS_APPSTARTUP_CONTRACTID);
|
|
||||||
|
|
||||||
if (appStartup) {
|
|
||||||
appStartup->GetShuttingDown(&skipNukeCrossCompartment);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!skipNukeCrossCompartment) {
|
|
||||||
// The compartment nuking phase might be too expensive, so do that
|
|
||||||
// part off of idle dispatch.
|
|
||||||
|
|
||||||
// For the compartment nuking phase, we dispatch either an
|
|
||||||
// inner-window-nuked or an outer-window-nuked notification.
|
|
||||||
// This will allow tests to wait for compartment nuking to happen.
|
|
||||||
if (mTopic.EqualsLiteral("inner-window-destroyed")) {
|
|
||||||
mTopic.AssignLiteral("inner-window-nuked");
|
|
||||||
} else if (mTopic.EqualsLiteral("outer-window-destroyed")) {
|
|
||||||
mTopic.AssignLiteral("outer-window-nuked");
|
|
||||||
}
|
|
||||||
mPhase = Phase::Nuking;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIRunnable> copy(this);
|
|
||||||
NS_IdleDispatchToCurrentThread(copy.forget(), 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Phase::Nuking:
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsISupports> window = do_QueryReferent(mWindow);
|
|
||||||
if (window) {
|
|
||||||
nsGlobalWindowInner* currentInner;
|
|
||||||
if (mIsInnerWindow) {
|
|
||||||
currentInner = nsGlobalWindowInner::FromSupports(window);
|
|
||||||
} else {
|
|
||||||
nsGlobalWindowOuter* outer = nsGlobalWindowOuter::FromSupports(window);
|
|
||||||
currentInner = outer->GetCurrentInnerWindowInternal();
|
|
||||||
}
|
|
||||||
NS_ENSURE_TRUE(currentInner, NS_OK);
|
|
||||||
|
|
||||||
AutoSafeJSContext cx;
|
|
||||||
JS::Rooted<JSObject*> obj(cx, currentInner->FastGetGlobalJSObject());
|
|
||||||
if (obj && !js::IsSystemCompartment(js::GetObjectCompartment(obj))) {
|
|
||||||
JSCompartment* cpt = js::GetObjectCompartment(obj);
|
|
||||||
nsCOMPtr<nsIPrincipal> pc = nsJSPrincipals::get(JS_GetCompartmentPrincipals(cpt));
|
|
||||||
|
|
||||||
if (BasePrincipal::Cast(pc)->AddonPolicy()) {
|
|
||||||
// We want to nuke all references to the add-on compartment.
|
|
||||||
xpc::NukeAllWrappersForCompartment(cx, cpt,
|
|
||||||
mIsInnerWindow ? js::DontNukeWindowReferences
|
|
||||||
: js::NukeWindowReferences);
|
|
||||||
} else {
|
|
||||||
// We only want to nuke wrappers for the chrome->content case
|
|
||||||
js::NukeCrossCompartmentWrappers(cx, BrowserCompartmentMatcher(), cpt,
|
|
||||||
mIsInnerWindow ? js::DontNukeWindowReferences
|
|
||||||
: js::NukeWindowReferences,
|
|
||||||
js::NukeIncomingReferences);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint64_t mID;
|
|
||||||
Phase mPhase;
|
|
||||||
nsCString mTopic;
|
|
||||||
nsWeakPtr mWindow;
|
|
||||||
bool mIsInnerWindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChildCommandDispatcher : public Runnable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ChildCommandDispatcher(nsPIWindowRoot* aRoot,
|
|
||||||
nsITabChild* aTabChild,
|
|
||||||
const nsAString& aAction)
|
|
||||||
: mozilla::Runnable("ChildCommandDispatcher")
|
|
||||||
, mRoot(aRoot)
|
|
||||||
, mTabChild(aTabChild)
|
|
||||||
, mAction(aAction)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHOD Run() override
|
|
||||||
{
|
|
||||||
nsTArray<nsCString> enabledCommands, disabledCommands;
|
|
||||||
mRoot->GetEnabledDisabledCommands(enabledCommands, disabledCommands);
|
|
||||||
if (enabledCommands.Length() || disabledCommands.Length()) {
|
|
||||||
mTabChild->EnableDisableCommands(mAction, enabledCommands, disabledCommands);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsCOMPtr<nsPIWindowRoot> mRoot;
|
|
||||||
nsCOMPtr<nsITabChild> mTabChild;
|
|
||||||
nsString mAction;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CommandDispatcher : public Runnable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CommandDispatcher(nsIDOMXULCommandDispatcher* aDispatcher,
|
|
||||||
const nsAString& aAction)
|
|
||||||
: mozilla::Runnable("CommandDispatcher")
|
|
||||||
, mDispatcher(aDispatcher)
|
|
||||||
, mAction(aAction)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHOD Run() override
|
|
||||||
{
|
|
||||||
return mDispatcher->UpdateCommands(mAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULCommandDispatcher> mDispatcher;
|
|
||||||
nsString mAction;
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool IsLink(nsIContent* aContent)
|
|
||||||
{
|
|
||||||
return aContent && (aContent->IsHTMLElement(nsGkAtoms::a) ||
|
|
||||||
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
|
||||||
nsGkAtoms::simple, eCaseMatters));
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ShouldShowFocusRingIfFocusedByMouse(nsIContent* aNode)
|
|
||||||
{
|
|
||||||
if (!aNode) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return !IsLink(aNode) &&
|
|
||||||
!aNode->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
IsInterval(const Optional<int32_t>& aTimeout, int32_t& aResultTimeout)
|
|
||||||
{
|
|
||||||
if (aTimeout.WasPassed()) {
|
|
||||||
aResultTimeout = aTimeout.Value();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no interval was specified, treat this like a timeout, to avoid setting
|
|
||||||
// an interval of 0 milliseconds.
|
|
||||||
aResultTimeout = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
mozilla::dom::DocGroup*
|
|
||||||
nsPIDOMWindow<T>::GetDocGroup() const
|
|
||||||
{
|
|
||||||
nsIDocument* doc = GetExtantDoc();
|
|
||||||
if (doc) {
|
|
||||||
return doc->GetDocGroup();
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
EnsurePrefCaches()
|
|
||||||
{
|
|
||||||
static bool sFirstTime = true;
|
|
||||||
if (sFirstTime) {
|
|
||||||
TimeoutManager::Initialize();
|
|
||||||
Preferences::AddBoolVarCache(&gIdleObserversAPIFuzzTimeDisabled,
|
|
||||||
"dom.idle-observers-api.fuzz_time.disabled",
|
|
||||||
false);
|
|
||||||
|
|
||||||
Preferences::AddUintVarCache(&gThrottledIdlePeriodLength,
|
|
||||||
"dom.idle_period.throttled_length",
|
|
||||||
DEFAULT_THROTTLED_IDLE_PERIOD_LENGTH);
|
|
||||||
sFirstTime = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include the implementations for the inner and outer windows respectively.
|
|
||||||
#include "nsGlobalWindowOuter.cpp"
|
|
||||||
#include "nsGlobalWindowInner.cpp"
|
|
||||||
|
|
||||||
template class nsPIDOMWindow<mozIDOMWindowProxy>;
|
|
||||||
template class nsPIDOMWindow<mozIDOMWindow>;
|
|
|
@ -7,24 +7,6 @@
|
||||||
#ifndef nsGlobalWindow_h___
|
#ifndef nsGlobalWindow_h___
|
||||||
#define nsGlobalWindow_h___
|
#define nsGlobalWindow_h___
|
||||||
|
|
||||||
// XXX(nika): Figure out where to put this?
|
|
||||||
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
||||||
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
||||||
|
|
||||||
// Amount of time allowed between alert/prompt/confirm before enabling
|
|
||||||
// the stop dialog checkbox.
|
|
||||||
#define DEFAULT_SUCCESSIVE_DIALOG_TIME_LIMIT 3 // 3 sec
|
|
||||||
|
|
||||||
// Maximum number of successive dialogs before we prompt users to disable
|
|
||||||
// dialogs for this window.
|
|
||||||
#define MAX_SUCCESSIVE_DIALOG_COUNT 5
|
|
||||||
|
|
||||||
// Idle fuzz time upper limit
|
|
||||||
#define MAX_IDLE_FUZZ_TIME_MS 90000
|
|
||||||
|
|
||||||
// Min idle notification time in seconds.
|
|
||||||
#define MIN_IDLE_NOTIFICATION_TIME_S 1
|
|
||||||
|
|
||||||
// NOTE: This is so that I can rewrite the includes in a separate patch.
|
// NOTE: This is so that I can rewrite the includes in a separate patch.
|
||||||
// Specificially I don't think I want to change this until I've moved everything
|
// Specificially I don't think I want to change this until I've moved everything
|
||||||
// to mozilla/dom/Window.h and mozilla/dom/WindowProxy.h.
|
// to mozilla/dom/Window.h and mozilla/dom/WindowProxy.h.
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -192,27 +192,17 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||||
CycleCollectionNoteChild(aCallback, aField.mIdleObserver.get(), aName, aFlags);
|
CycleCollectionNoteChild(aCallback, aField.mIdleObserver.get(), aName, aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Currently this file, despite being named mozilla/dom/Window.h, exports
|
|
||||||
// the class nsGlobalWindowInner. It will be renamed in the future to
|
|
||||||
// mozilla::dom::Window.
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// nsGlobalWindow: Global Object for Scripting
|
// nsGlobalWindowInner: Global Object for Scripting
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// Beware that all scriptable interfaces implemented by
|
|
||||||
// nsGlobalWindow will be reachable from JS, if you make this class
|
|
||||||
// implement new interfaces you better know what you're
|
|
||||||
// doing. Security wise this is very sensitive code. --
|
|
||||||
// jst@netscape.com
|
|
||||||
|
|
||||||
// nsGlobalWindow inherits PRCList for maintaining a list of all inner
|
// nsGlobalWindowInner inherits PRCList for maintaining a list of all inner
|
||||||
// windows still in memory for any given outer window. This list is
|
// windows still in memory for any given outer window. This list is needed to
|
||||||
// needed to ensure that mOuterWindow doesn't end up dangling. The
|
// ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means
|
||||||
// nature of PRCList means that the window itself is always in the
|
// that the window itself is always in the list, and an outer window's list will
|
||||||
// list, and an outer window's list will also contain all inner window
|
// also contain all inner window objects that are still in memory (and in
|
||||||
// objects that are still in memory (and in reality all inner window
|
// reality all inner window object's lists also contain its outer and all other
|
||||||
// object's lists also contain its outer and all other inner windows
|
// inner windows belonging to the same outer window, but that's an unimportant
|
||||||
// belonging to the same outer window, but that's an unimportant
|
|
||||||
// side effect of inheriting PRCList).
|
// side effect of inheriting PRCList).
|
||||||
|
|
||||||
class nsGlobalWindowInner : public mozilla::dom::EventTarget,
|
class nsGlobalWindowInner : public mozilla::dom::EventTarget,
|
||||||
|
@ -262,8 +252,6 @@ public:
|
||||||
|
|
||||||
nsGlobalWindowInner* innerWindow =
|
nsGlobalWindowInner* innerWindow =
|
||||||
sInnerWindowsById->Get(aInnerWindowID);
|
sInnerWindowsById->Get(aInnerWindowID);
|
||||||
MOZ_ASSERT(!innerWindow || innerWindow->IsInnerWindow(),
|
|
||||||
"Outer window in sInnerWindowsById?");
|
|
||||||
return innerWindow;
|
return innerWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +279,7 @@ public:
|
||||||
// nsWrapperCache
|
// nsWrapperCache
|
||||||
virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override
|
virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override
|
||||||
{
|
{
|
||||||
return IsInnerWindow() || AsOuter()->EnsureInnerWindow() ? GetWrapper() : nullptr;
|
return GetWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
// nsIGlobalJSObjectHolder
|
// nsIGlobalJSObjectHolder
|
||||||
|
@ -348,22 +336,10 @@ public:
|
||||||
virtual nsPIDOMWindowOuter* GetPrivateRoot() override;
|
virtual nsPIDOMWindowOuter* GetPrivateRoot() override;
|
||||||
|
|
||||||
// Outer windows only.
|
// Outer windows only.
|
||||||
virtual void ActivateOrDeactivate(bool aActivate) override;
|
|
||||||
virtual void SetActive(bool aActive) override;
|
|
||||||
virtual bool IsTopLevelWindowActive() override;
|
virtual bool IsTopLevelWindowActive() override;
|
||||||
virtual void SetIsBackground(bool aIsBackground) override;
|
|
||||||
virtual void SetChromeEventHandler(mozilla::dom::EventTarget* aChromeEventHandler) override;
|
|
||||||
|
|
||||||
// Outer windows only.
|
|
||||||
virtual void SetInitialPrincipalToSubject() override;
|
|
||||||
|
|
||||||
virtual PopupControlState PushPopupControlState(PopupControlState state, bool aForce) const override;
|
|
||||||
virtual void PopPopupControlState(PopupControlState state) const override;
|
|
||||||
virtual PopupControlState GetPopupControlState() const override;
|
virtual PopupControlState GetPopupControlState() const override;
|
||||||
|
|
||||||
virtual already_AddRefed<nsISupports> SaveWindowState() override;
|
|
||||||
virtual nsresult RestoreWindowState(nsISupports *aState) override;
|
|
||||||
|
|
||||||
void Suspend();
|
void Suspend();
|
||||||
void Resume();
|
void Resume();
|
||||||
virtual bool IsSuspended() const override;
|
virtual bool IsSuspended() const override;
|
||||||
|
@ -383,33 +359,14 @@ public:
|
||||||
virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
|
virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
|
||||||
bool aOriginalOpener) override;
|
bool aOriginalOpener) override;
|
||||||
|
|
||||||
// Outer windows only.
|
|
||||||
virtual void EnsureSizeAndPositionUpToDate() override;
|
|
||||||
|
|
||||||
virtual void EnterModalState() override;
|
|
||||||
virtual void LeaveModalState() override;
|
|
||||||
|
|
||||||
// Outer windows only.
|
|
||||||
virtual bool CanClose() override;
|
|
||||||
virtual void ForceClose() override;
|
|
||||||
|
|
||||||
virtual void MaybeUpdateTouchState() override;
|
virtual void MaybeUpdateTouchState() override;
|
||||||
|
|
||||||
// Outer windows only.
|
|
||||||
virtual bool DispatchCustomEvent(const nsAString& aEventName) override;
|
|
||||||
|
|
||||||
// Inner windows only.
|
// Inner windows only.
|
||||||
void RefreshCompartmentPrincipal();
|
void RefreshCompartmentPrincipal();
|
||||||
|
|
||||||
// For accessing protected field mFullScreen
|
// For accessing protected field mFullScreen
|
||||||
friend class FullscreenTransitionTask;
|
friend class FullscreenTransitionTask;
|
||||||
|
|
||||||
// Outer windows only.
|
|
||||||
virtual nsresult SetFullscreenInternal(
|
|
||||||
FullscreenReason aReason, bool aIsFullscreen) override final;
|
|
||||||
virtual void FullscreenWillChange(bool aIsFullscreen) override final;
|
|
||||||
virtual void FinishFullscreenChange(bool aIsFullscreen) override final;
|
|
||||||
|
|
||||||
// Inner windows only.
|
// Inner windows only.
|
||||||
virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override;
|
virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override;
|
||||||
void NotifyVREventListenerAdded();
|
void NotifyVREventListenerAdded();
|
||||||
|
@ -444,7 +401,6 @@ public:
|
||||||
void GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
|
void GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
|
||||||
bool aEnumerableOnly, mozilla::ErrorResult& aRv);
|
bool aEnumerableOnly, mozilla::ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetTop() override;
|
|
||||||
nsPIDOMWindowOuter* GetScriptableTop() override;
|
nsPIDOMWindowOuter* GetScriptableTop() override;
|
||||||
inline nsGlobalWindowOuter *GetTopInternal();
|
inline nsGlobalWindowOuter *GetTopInternal();
|
||||||
|
|
||||||
|
@ -475,11 +431,6 @@ public:
|
||||||
|
|
||||||
nsGlobalWindowOuter *GetOuterWindowInternal() const;
|
nsGlobalWindowOuter *GetOuterWindowInternal() const;
|
||||||
|
|
||||||
bool IsCreatingInnerWindow() const
|
|
||||||
{
|
|
||||||
return mCreatingInnerWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsChromeWindow() const
|
bool IsChromeWindow() const
|
||||||
{
|
{
|
||||||
return mIsChrome;
|
return mIsChrome;
|
||||||
|
@ -538,13 +489,8 @@ public:
|
||||||
virtual void EnableTimeChangeNotifications() override;
|
virtual void EnableTimeChangeNotifications() override;
|
||||||
virtual void DisableTimeChangeNotifications() override;
|
virtual void DisableTimeChangeNotifications() override;
|
||||||
|
|
||||||
virtual nsresult SetArguments(nsIArray* aArguments) override;
|
|
||||||
|
|
||||||
bool IsClosedOrClosing() {
|
bool IsClosedOrClosing() {
|
||||||
return (mIsClosed ||
|
return mCleanedUp;
|
||||||
mInClose ||
|
|
||||||
mHavePendingClose ||
|
|
||||||
mCleanedUp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -553,12 +499,6 @@ public:
|
||||||
return mCleanedUp;
|
return mCleanedUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
|
||||||
FirePopupBlockedEvent(nsIDocument* aDoc,
|
|
||||||
nsIURI* aPopupURI,
|
|
||||||
const nsAString& aPopupWindowName,
|
|
||||||
const nsAString& aPopupWindowFeatures) override;
|
|
||||||
|
|
||||||
virtual uint32_t GetSerial() override {
|
virtual uint32_t GetSerial() override {
|
||||||
return mSerial;
|
return mSerial;
|
||||||
}
|
}
|
||||||
|
@ -575,11 +515,6 @@ public:
|
||||||
bool ContainsIdleObserver(nsIIdleObserver* aIdleObserver, uint32_t timeInS);
|
bool ContainsIdleObserver(nsIIdleObserver* aIdleObserver, uint32_t timeInS);
|
||||||
void HandleIdleObserverCallback();
|
void HandleIdleObserverCallback();
|
||||||
|
|
||||||
void AllowScriptsToClose()
|
|
||||||
{
|
|
||||||
mAllowScriptsToClose = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum SlowScriptResponse {
|
enum SlowScriptResponse {
|
||||||
ContinueSlowScript = 0,
|
ContinueSlowScript = 0,
|
||||||
ContinueSlowScriptAndKeepNotifying,
|
ContinueSlowScriptAndKeepNotifying,
|
||||||
|
@ -707,7 +642,6 @@ public:
|
||||||
void Close(mozilla::ErrorResult& aError);
|
void Close(mozilla::ErrorResult& aError);
|
||||||
nsresult Close() override;
|
nsresult Close() override;
|
||||||
bool GetClosed(mozilla::ErrorResult& aError);
|
bool GetClosed(mozilla::ErrorResult& aError);
|
||||||
bool Closed() override;
|
|
||||||
void Stop(mozilla::ErrorResult& aError);
|
void Stop(mozilla::ErrorResult& aError);
|
||||||
void Focus(mozilla::ErrorResult& aError);
|
void Focus(mozilla::ErrorResult& aError);
|
||||||
nsresult Focus() override;
|
nsresult Focus() override;
|
||||||
|
@ -716,8 +650,6 @@ public:
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetFrames(mozilla::ErrorResult& aError);
|
already_AddRefed<nsPIDOMWindowOuter> GetFrames(mozilla::ErrorResult& aError);
|
||||||
uint32_t Length();
|
uint32_t Length();
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetTop(mozilla::ErrorResult& aError);
|
already_AddRefed<nsPIDOMWindowOuter> GetTop(mozilla::ErrorResult& aError);
|
||||||
|
|
||||||
nsresult GetPrompter(nsIPrompt** aPrompt) override;
|
|
||||||
protected:
|
protected:
|
||||||
explicit nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow);
|
explicit nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow);
|
||||||
// Initializes the mWasOffline member variable
|
// Initializes the mWasOffline member variable
|
||||||
|
@ -726,11 +658,9 @@ public:
|
||||||
nsPIDOMWindowOuter* GetOpenerWindow(mozilla::ErrorResult& aError);
|
nsPIDOMWindowOuter* GetOpenerWindow(mozilla::ErrorResult& aError);
|
||||||
void GetOpener(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
|
void GetOpener(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetOpener() override;
|
|
||||||
void SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
|
void SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetParent(mozilla::ErrorResult& aError);
|
already_AddRefed<nsPIDOMWindowOuter> GetParent(mozilla::ErrorResult& aError);
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetParent() override;
|
|
||||||
nsPIDOMWindowOuter* GetScriptableParent() override;
|
nsPIDOMWindowOuter* GetScriptableParent() override;
|
||||||
nsPIDOMWindowOuter* GetScriptableParentOrNull() override;
|
nsPIDOMWindowOuter* GetScriptableParentOrNull() override;
|
||||||
mozilla::dom::Element*
|
mozilla::dom::Element*
|
||||||
|
@ -742,11 +672,6 @@ public:
|
||||||
const nsAString& aName,
|
const nsAString& aName,
|
||||||
const nsAString& aOptions,
|
const nsAString& aOptions,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
|
||||||
const nsAString& aOptions,
|
|
||||||
nsIDocShellLoadInfo* aLoadInfo,
|
|
||||||
bool aForceNoOpener,
|
|
||||||
nsPIDOMWindowOuter **_retval) override;
|
|
||||||
mozilla::dom::Navigator* Navigator();
|
mozilla::dom::Navigator* Navigator();
|
||||||
nsIDOMNavigator* GetNavigator() override;
|
nsIDOMNavigator* GetNavigator() override;
|
||||||
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
|
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
|
||||||
|
@ -836,7 +761,6 @@ public:
|
||||||
mozilla::dom::Storage*
|
mozilla::dom::Storage*
|
||||||
GetLocalStorage(mozilla::ErrorResult& aError);
|
GetLocalStorage(mozilla::ErrorResult& aError);
|
||||||
mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aError);
|
mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aError);
|
||||||
already_AddRefed<nsISelection> GetSelection() override;
|
|
||||||
mozilla::dom::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError);
|
mozilla::dom::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError);
|
||||||
already_AddRefed<nsICSSDeclaration>
|
already_AddRefed<nsICSSDeclaration>
|
||||||
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
|
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
|
||||||
|
@ -853,7 +777,6 @@ public:
|
||||||
void MoveBy(int32_t aXDif, int32_t aYDif,
|
void MoveBy(int32_t aXDif, int32_t aYDif,
|
||||||
mozilla::dom::CallerType aCallerType,
|
mozilla::dom::CallerType aCallerType,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
nsresult MoveBy(int32_t aXDif, int32_t aYDif) override;
|
|
||||||
void ResizeTo(int32_t aWidth, int32_t aHeight,
|
void ResizeTo(int32_t aWidth, int32_t aHeight,
|
||||||
mozilla::dom::CallerType aCallerType,
|
mozilla::dom::CallerType aCallerType,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
|
@ -956,7 +879,6 @@ public:
|
||||||
bool GetFullScreen(mozilla::ErrorResult& aError);
|
bool GetFullScreen(mozilla::ErrorResult& aError);
|
||||||
bool GetFullScreen() override;
|
bool GetFullScreen() override;
|
||||||
void SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError);
|
void SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError);
|
||||||
nsresult SetFullScreen(bool aFullScreen) override;
|
|
||||||
void Back(mozilla::ErrorResult& aError);
|
void Back(mozilla::ErrorResult& aError);
|
||||||
void Forward(mozilla::ErrorResult& aError);
|
void Forward(mozilla::ErrorResult& aError);
|
||||||
void Home(nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
|
void Home(nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
|
||||||
|
@ -976,10 +898,6 @@ public:
|
||||||
const nsAString& aOptions,
|
const nsAString& aOptions,
|
||||||
const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
|
const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
|
||||||
const nsAString& aOptions,
|
|
||||||
nsISupports* aExtraArgument,
|
|
||||||
nsPIDOMWindowOuter** _retval) override;
|
|
||||||
nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
|
nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
|
||||||
|
|
||||||
void GetContent(JSContext* aCx,
|
void GetContent(JSContext* aCx,
|
||||||
|
@ -1157,9 +1075,6 @@ protected:
|
||||||
// Object Management
|
// Object Management
|
||||||
virtual ~nsGlobalWindowInner();
|
virtual ~nsGlobalWindowInner();
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
void ClearControllers();
|
|
||||||
|
|
||||||
inline void MaybeClearInnerWindow(nsGlobalWindowInner* aExpectedInner);
|
|
||||||
|
|
||||||
void FreeInnerObjects();
|
void FreeInnerObjects();
|
||||||
nsGlobalWindowInner *CallerInnerWindow();
|
nsGlobalWindowInner *CallerInnerWindow();
|
||||||
|
@ -1181,16 +1096,6 @@ public:
|
||||||
// popup tracking
|
// popup tracking
|
||||||
bool IsPopupSpamWindow();
|
bool IsPopupSpamWindow();
|
||||||
|
|
||||||
protected:
|
|
||||||
// Window Control Functions
|
|
||||||
|
|
||||||
// Outer windows only.
|
|
||||||
virtual nsresult
|
|
||||||
OpenNoNavigate(const nsAString& aUrl,
|
|
||||||
const nsAString& aName,
|
|
||||||
const nsAString& aOptions,
|
|
||||||
nsPIDOMWindowOuter** _retval) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename Method>
|
template<typename Method>
|
||||||
void CallOnChildren(Method aMethod);
|
void CallOnChildren(Method aMethod);
|
||||||
|
@ -1256,9 +1161,6 @@ public:
|
||||||
|
|
||||||
virtual bool ShouldShowFocusRing() override;
|
virtual bool ShouldShowFocusRing() override;
|
||||||
|
|
||||||
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
||||||
UIStateChangeType aShowFocusRings) override;
|
|
||||||
|
|
||||||
// Inner windows only.
|
// Inner windows only.
|
||||||
void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent);
|
void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent);
|
||||||
|
|
||||||
|
@ -1310,10 +1212,7 @@ private:
|
||||||
|
|
||||||
void DisconnectEventTargetObjects();
|
void DisconnectEventTargetObjects();
|
||||||
|
|
||||||
// nsPIDOMWindow<T> should be able to see these helper methods.
|
// nsPIDOMWindow{Inner,Outer} should be able to see these helper methods.
|
||||||
friend class nsPIDOMWindow<mozIDOMWindowProxy>;
|
|
||||||
friend class nsPIDOMWindow<mozIDOMWindow>;
|
|
||||||
friend class nsPIDOMWindow<nsISupports>;
|
|
||||||
friend class nsPIDOMWindowInner;
|
friend class nsPIDOMWindowInner;
|
||||||
friend class nsPIDOMWindowOuter;
|
friend class nsPIDOMWindowOuter;
|
||||||
|
|
||||||
|
@ -1360,23 +1259,7 @@ public:
|
||||||
void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
|
void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// These members are only used on outer window objects. Make sure
|
|
||||||
// you never set any of these on an inner object!
|
|
||||||
bool mFullScreen : 1;
|
|
||||||
bool mFullscreenMode : 1;
|
|
||||||
bool mIsClosed : 1;
|
|
||||||
bool mInClose : 1;
|
|
||||||
// mHavePendingClose means we've got a termination function set to
|
|
||||||
// close us when the JS stops executing or that we have a close
|
|
||||||
// event posted. If this is set, just ignore window.close() calls.
|
|
||||||
bool mHavePendingClose : 1;
|
|
||||||
bool mHadOriginalOpener : 1;
|
|
||||||
bool mOriginalOpenerWasSecureContext : 1;
|
|
||||||
bool mIsSecureContextIfOpenerIgnored : 1;
|
bool mIsSecureContextIfOpenerIgnored : 1;
|
||||||
bool mIsPopupSpam : 1;
|
|
||||||
|
|
||||||
// Indicates whether scripts are allowed to close this window.
|
|
||||||
bool mBlockScriptedClosingFlag : 1;
|
|
||||||
|
|
||||||
// Window offline status. Checked to see if we need to fire offline event
|
// Window offline status. Checked to see if we need to fire offline event
|
||||||
bool mWasOffline : 1;
|
bool mWasOffline : 1;
|
||||||
|
@ -1390,10 +1273,6 @@ protected:
|
||||||
bool mNotifyIdleObserversIdleOnThaw : 1;
|
bool mNotifyIdleObserversIdleOnThaw : 1;
|
||||||
bool mNotifyIdleObserversActiveOnThaw : 1;
|
bool mNotifyIdleObserversActiveOnThaw : 1;
|
||||||
|
|
||||||
// Indicates whether we're in the middle of creating an initializing
|
|
||||||
// a new inner window object.
|
|
||||||
bool mCreatingInnerWindow : 1;
|
|
||||||
|
|
||||||
// Fast way to tell if this is a chrome window (without having to QI).
|
// Fast way to tell if this is a chrome window (without having to QI).
|
||||||
bool mIsChrome : 1;
|
bool mIsChrome : 1;
|
||||||
|
|
||||||
|
@ -1415,53 +1294,29 @@ protected:
|
||||||
// should be displayed.
|
// should be displayed.
|
||||||
bool mFocusByKeyOccurred : 1;
|
bool mFocusByKeyOccurred : 1;
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
// Indicates whether this window wants gamepad input events
|
// Indicates whether this window wants gamepad input events
|
||||||
bool mHasGamepad : 1;
|
bool mHasGamepad : 1;
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
// Indicates whether this window wants VR events
|
// Indicates whether this window wants VR events
|
||||||
bool mHasVREvents : 1;
|
bool mHasVREvents : 1;
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
// Indicates whether this window wants VRDisplayActivate events
|
// Indicates whether this window wants VRDisplayActivate events
|
||||||
bool mHasVRDisplayActivateEvents : 1;
|
bool mHasVRDisplayActivateEvents : 1;
|
||||||
nsCheapSet<nsUint32HashKey> mGamepadIndexSet;
|
nsCheapSet<nsUint32HashKey> mGamepadIndexSet;
|
||||||
nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
|
nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
|
||||||
bool mHasSeenGamepadInput;
|
bool mHasSeenGamepadInput;
|
||||||
|
|
||||||
// whether we've sent the destroy notification for our window id
|
|
||||||
bool mNotifiedIDDestroyed : 1;
|
|
||||||
// whether scripts may close the window,
|
|
||||||
// even if "dom.allow_scripts_to_close_windows" is false.
|
|
||||||
bool mAllowScriptsToClose : 1;
|
|
||||||
|
|
||||||
bool mTopLevelOuterContentWindow : 1;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptContext> mContext;
|
|
||||||
nsWeakPtr mOpener;
|
|
||||||
nsCOMPtr<nsIControllers> mControllers;
|
|
||||||
|
|
||||||
// For |window.arguments|, via |openDialog|.
|
|
||||||
nsCOMPtr<nsIArray> mArguments;
|
|
||||||
|
|
||||||
// Only used in the outer.
|
|
||||||
RefPtr<DialogValueHolder> mReturnValue;
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::Navigator> mNavigator;
|
RefPtr<mozilla::dom::Navigator> mNavigator;
|
||||||
RefPtr<nsScreen> mScreen;
|
RefPtr<nsScreen> mScreen;
|
||||||
RefPtr<nsDOMWindowList> mFrames;
|
|
||||||
// All BarProps are inner window only.
|
|
||||||
RefPtr<mozilla::dom::BarProp> mMenubar;
|
RefPtr<mozilla::dom::BarProp> mMenubar;
|
||||||
RefPtr<mozilla::dom::BarProp> mToolbar;
|
RefPtr<mozilla::dom::BarProp> mToolbar;
|
||||||
RefPtr<mozilla::dom::BarProp> mLocationbar;
|
RefPtr<mozilla::dom::BarProp> mLocationbar;
|
||||||
RefPtr<mozilla::dom::BarProp> mPersonalbar;
|
RefPtr<mozilla::dom::BarProp> mPersonalbar;
|
||||||
RefPtr<mozilla::dom::BarProp> mStatusbar;
|
RefPtr<mozilla::dom::BarProp> mStatusbar;
|
||||||
RefPtr<mozilla::dom::BarProp> mScrollbars;
|
RefPtr<mozilla::dom::BarProp> mScrollbars;
|
||||||
RefPtr<nsDOMWindowUtils> mWindowUtils;
|
|
||||||
nsString mStatus;
|
RefPtr<nsGlobalWindowObserver> mObserver;
|
||||||
nsString mDefaultStatus;
|
|
||||||
RefPtr<nsGlobalWindowObserver> mObserver; // Inner windows only.
|
|
||||||
RefPtr<mozilla::dom::Crypto> mCrypto;
|
RefPtr<mozilla::dom::Crypto> mCrypto;
|
||||||
RefPtr<mozilla::dom::U2F> mU2F;
|
RefPtr<mozilla::dom::U2F> mU2F;
|
||||||
RefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
|
RefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
|
||||||
|
@ -1479,13 +1334,11 @@ protected:
|
||||||
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
||||||
RefPtr<mozilla::dom::Storage> mSessionStorage;
|
RefPtr<mozilla::dom::Storage> mSessionStorage;
|
||||||
|
|
||||||
// These member variable are used only on inner windows.
|
|
||||||
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||||
RefPtr<mozilla::dom::Location> mLocation;
|
RefPtr<mozilla::dom::Location> mLocation;
|
||||||
RefPtr<nsHistory> mHistory;
|
RefPtr<nsHistory> mHistory;
|
||||||
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
||||||
|
|
||||||
// These member variables are used on both inner and the outer windows.
|
|
||||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
||||||
// mTabChild is only ever populated in the content process.
|
// mTabChild is only ever populated in the content process.
|
||||||
nsCOMPtr<nsITabChild> mTabChild;
|
nsCOMPtr<nsITabChild> mTabChild;
|
||||||
|
@ -1504,7 +1357,6 @@ protected:
|
||||||
RefPtr<IdleRequestExecutor> mIdleRequestExecutor;
|
RefPtr<IdleRequestExecutor> mIdleRequestExecutor;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool mSetOpenerWindowCalled;
|
|
||||||
nsCOMPtr<nsIURI> mLastOpenedURI;
|
nsCOMPtr<nsIURI> mLastOpenedURI;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1515,14 +1367,6 @@ protected:
|
||||||
using XBLPrototypeHandlerTable = nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>;
|
using XBLPrototypeHandlerTable = nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>;
|
||||||
mozilla::UniquePtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers;
|
mozilla::UniquePtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers;
|
||||||
|
|
||||||
// mSuspendedDoc is only set on outer windows. It's useful when we get matched
|
|
||||||
// EnterModalState/LeaveModalState calls, in which case the outer window is
|
|
||||||
// responsible for unsuspending events on the document. If we don't (for
|
|
||||||
// example, if the outer window is closed before the LeaveModalState call),
|
|
||||||
// then the inner window whose mDoc is our mSuspendedDoc is responsible for
|
|
||||||
// unsuspending it.
|
|
||||||
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::IDBFactory> mIndexedDB;
|
RefPtr<mozilla::dom::IDBFactory> mIndexedDB;
|
||||||
|
|
||||||
// This counts the number of windows that have been opened in rapid succession
|
// This counts the number of windows that have been opened in rapid succession
|
||||||
|
@ -1550,16 +1394,9 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_WEBSPEECH
|
#ifdef MOZ_WEBSPEECH
|
||||||
// mSpeechSynthesis is only used on inner windows.
|
|
||||||
RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;
|
RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// This member is used in the debug only assertions in TabGroup()
|
|
||||||
// to catch cyclic parent/opener trees and not overflow the stack.
|
|
||||||
bool mIsValidatingTabGroup;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is the CC generation the last time we called CanSkip.
|
// This is the CC generation the last time we called CanSkip.
|
||||||
uint32_t mCanSkipCCGeneration;
|
uint32_t mCanSkipCCGeneration;
|
||||||
|
|
||||||
|
@ -1568,11 +1405,7 @@ protected:
|
||||||
|
|
||||||
RefPtr<mozilla::dom::VREventObserver> mVREventObserver;
|
RefPtr<mozilla::dom::VREventObserver> mVREventObserver;
|
||||||
|
|
||||||
// When non-zero, the document should receive a vrdisplayactivate event
|
int64_t mBeforeUnloadListenerCount;
|
||||||
// after loading. The value is the ID of the VRDisplay that content should
|
|
||||||
// begin presentation on.
|
|
||||||
uint32_t mAutoActivateVRDisplayID; // Outer windows only
|
|
||||||
int64_t mBeforeUnloadListenerCount; // Inner windows only
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::IntlUtils> mIntlUtils;
|
RefPtr<mozilla::dom::IntlUtils> mIntlUtils;
|
||||||
|
|
||||||
|
@ -1587,16 +1420,15 @@ protected:
|
||||||
: mGroupMessageManagers(1)
|
: mGroupMessageManagers(1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
|
||||||
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
||||||
nsInterfaceHashtable<nsStringHashKey, nsIMessageBroadcaster> mGroupMessageManagers;
|
nsInterfaceHashtable<nsStringHashKey, nsIMessageBroadcaster> mGroupMessageManagers;
|
||||||
// A weak pointer to the nsPresShell that we are doing fullscreen for.
|
|
||||||
// The pointer being set indicates we've set the IsInFullscreenChange
|
|
||||||
// flag on this pres shell.
|
|
||||||
nsWeakPtr mFullscreenPresShell;
|
|
||||||
nsCOMPtr<mozIDOMWindowProxy> mOpenerForInitialContentBrowser;
|
|
||||||
} mChromeFields;
|
} mChromeFields;
|
||||||
|
|
||||||
|
// These fields are used by the inner and outer windows to prevent
|
||||||
|
// programatically moving the window while the mouse is down.
|
||||||
|
static bool sMouseDown;
|
||||||
|
static bool sDragServiceDisabled;
|
||||||
|
|
||||||
friend class nsDOMScriptableHelper;
|
friend class nsDOMScriptableHelper;
|
||||||
friend class nsDOMWindowUtils;
|
friend class nsDOMWindowUtils;
|
||||||
friend class mozilla::dom::PostMessageEvent;
|
friend class mozilla::dom::PostMessageEvent;
|
||||||
|
@ -1652,7 +1484,7 @@ nsGlobalWindowInner::GetContextInternal()
|
||||||
return GetOuterWindowInternal()->mContext;
|
return GetOuterWindowInternal()->mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mContext;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline nsGlobalWindowOuter*
|
inline nsGlobalWindowOuter*
|
||||||
|
@ -1664,7 +1496,7 @@ nsGlobalWindowInner::GetOuterWindowInternal() const
|
||||||
inline bool
|
inline bool
|
||||||
nsGlobalWindowInner::IsPopupSpamWindow()
|
nsGlobalWindowInner::IsPopupSpamWindow()
|
||||||
{
|
{
|
||||||
if (IsInnerWindow() && !mOuterWindow) {
|
if (!mOuterWindow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1677,12 +1509,4 @@ nsGlobalWindowInner::IsFrame()
|
||||||
return GetParentInternal() != nullptr;
|
return GetParentInternal() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
nsGlobalWindowInner::MaybeClearInnerWindow(nsGlobalWindowInner* aExpectedInner)
|
|
||||||
{
|
|
||||||
if(mInnerWindow == aExpectedInner->AsInner()) {
|
|
||||||
mInnerWindow = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* nsGlobalWindowInner_h___ */
|
#endif /* nsGlobalWindowInner_h___ */
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -46,7 +46,6 @@
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/GuardObjects.h"
|
#include "mozilla/GuardObjects.h"
|
||||||
#include "mozilla/LinkedList.h"
|
#include "mozilla/LinkedList.h"
|
||||||
#include "mozilla/TimeStamp.h"
|
|
||||||
#include "nsWrapperCacheInlines.h"
|
#include "nsWrapperCacheInlines.h"
|
||||||
#include "nsIIdleObserver.h"
|
#include "nsIIdleObserver.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
@ -151,59 +150,17 @@ NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow,
|
||||||
|
|
||||||
extern const js::Class OuterWindowProxyClass;
|
extern const js::Class OuterWindowProxyClass;
|
||||||
|
|
||||||
// Helper class to manage modal dialog arguments and all their quirks.
|
|
||||||
//
|
|
||||||
// Given our clunky embedding APIs, modal dialog arguments need to be passed
|
|
||||||
// as an nsISupports parameter to WindowWatcher, get stuck inside an array of
|
|
||||||
// length 1, and then passed back to the newly-created dialog.
|
|
||||||
//
|
|
||||||
// However, we need to track both the caller-passed value as well as the
|
|
||||||
// caller's, so that we can do an origin check (even for primitives) when the
|
|
||||||
// value is accessed. This class encapsulates that magic.
|
|
||||||
//
|
|
||||||
// We also use the same machinery for |returnValue|, which needs similar origin
|
|
||||||
// checks.
|
|
||||||
class DialogValueHolder final : public nsISupports
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS(DialogValueHolder)
|
|
||||||
|
|
||||||
DialogValueHolder(nsIPrincipal* aSubject, nsIVariant* aValue)
|
|
||||||
: mOrigin(aSubject)
|
|
||||||
, mValue(aValue) {}
|
|
||||||
nsresult Get(nsIPrincipal* aSubject, nsIVariant** aResult);
|
|
||||||
void Get(JSContext* aCx, JS::Handle<JSObject*> aScope, nsIPrincipal* aSubject,
|
|
||||||
JS::MutableHandle<JS::Value> aResult, mozilla::ErrorResult& aError);
|
|
||||||
private:
|
|
||||||
virtual ~DialogValueHolder() {}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPrincipal> mOrigin;
|
|
||||||
nsCOMPtr<nsIVariant> mValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Currently this file, despite being named mozilla/dom/WindowProxy.h,
|
|
||||||
// exports the class nsGlobalWindowOuter. It will be renamed in the future to
|
|
||||||
// mozilla::dom::WindowProxy.
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// nsGlobalWindow: Global Object for Scripting
|
// nsGlobalWindowOuter
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// Beware that all scriptable interfaces implemented by
|
|
||||||
// nsGlobalWindow will be reachable from JS, if you make this class
|
|
||||||
// implement new interfaces you better know what you're
|
|
||||||
// doing. Security wise this is very sensitive code. --
|
|
||||||
// jst@netscape.com
|
|
||||||
|
|
||||||
// nsGlobalWindow inherits PRCList for maintaining a list of all inner
|
// nsGlobalWindowOuter inherits PRCList for maintaining a list of all inner
|
||||||
// windows still in memory for any given outer window. This list is
|
// windows still in memory for any given outer window. This list is needed to
|
||||||
// needed to ensure that mOuterWindow doesn't end up dangling. The
|
// ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means
|
||||||
// nature of PRCList means that the window itself is always in the
|
// that the window itself is always in the list, and an outer window's list will
|
||||||
// list, and an outer window's list will also contain all inner window
|
// also contain all inner window objects that are still in memory (and in
|
||||||
// objects that are still in memory (and in reality all inner window
|
// reality all inner window object's lists also contain its outer and all other
|
||||||
// object's lists also contain its outer and all other inner windows
|
// inner windows belonging to the same outer window, but that's an unimportant
|
||||||
// belonging to the same outer window, but that's an unimportant
|
|
||||||
// side effect of inheriting PRCList).
|
// side effect of inheriting PRCList).
|
||||||
|
|
||||||
class nsGlobalWindowOuter : public mozilla::dom::EventTarget,
|
class nsGlobalWindowOuter : public mozilla::dom::EventTarget,
|
||||||
|
@ -219,9 +176,6 @@ class nsGlobalWindowOuter : public mozilla::dom::EventTarget,
|
||||||
public PRCListStr
|
public PRCListStr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef mozilla::TimeStamp TimeStamp;
|
|
||||||
typedef mozilla::TimeDuration TimeDuration;
|
|
||||||
|
|
||||||
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowOuter*> OuterWindowByIdTable;
|
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowOuter*> OuterWindowByIdTable;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -252,8 +206,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGlobalWindowOuter* outerWindow = sOuterWindowsById->Get(aWindowID);
|
nsGlobalWindowOuter* outerWindow = sOuterWindowsById->Get(aWindowID);
|
||||||
MOZ_ASSERT(!outerWindow || outerWindow->IsOuterWindow(),
|
|
||||||
"Inner window in sOuterWindowsById?");
|
|
||||||
return outerWindow;
|
return outerWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,9 +358,6 @@ public:
|
||||||
nsIWidget* aWidget, nsIScreen* aScreen);
|
nsIWidget* aWidget, nsIScreen* aScreen);
|
||||||
bool FullScreen() const;
|
bool FullScreen() const;
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override;
|
|
||||||
|
|
||||||
using EventTarget::EventListenerAdded;
|
using EventTarget::EventListenerAdded;
|
||||||
virtual void EventListenerAdded(nsAtom* aType) override;
|
virtual void EventListenerAdded(nsAtom* aType) override;
|
||||||
using EventTarget::EventListenerRemoved;
|
using EventTarget::EventListenerRemoved;
|
||||||
|
@ -498,43 +447,14 @@ public:
|
||||||
static void ShutDown();
|
static void ShutDown();
|
||||||
static bool IsCallerChrome();
|
static bool IsCallerChrome();
|
||||||
|
|
||||||
void CleanupCachedXBLHandlers();
|
|
||||||
|
|
||||||
friend class WindowStateHolder;
|
friend class WindowStateHolder;
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindowOuter,
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindowOuter,
|
||||||
nsIDOMEventTarget)
|
nsIDOMEventTarget)
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// Call Unlink on this window. This may cause bad things to happen, so use
|
|
||||||
// with caution.
|
|
||||||
void RiskyUnlink();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual JSObject*
|
|
||||||
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override;
|
|
||||||
|
|
||||||
virtual void
|
|
||||||
CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
|
||||||
JS::Handle<JSObject*> aHandler) override;
|
|
||||||
|
|
||||||
virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override;
|
virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override;
|
||||||
virtual void SetReadyForFocus() override;
|
virtual void SetReadyForFocus() override;
|
||||||
virtual void PageHidden() override;
|
virtual void PageHidden() override;
|
||||||
virtual nsresult DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI) override;
|
|
||||||
virtual nsresult DispatchSyncPopState() override;
|
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
virtual void EnableDeviceSensor(uint32_t aType) override;
|
|
||||||
virtual void DisableDeviceSensor(uint32_t aType) override;
|
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_ANDROID)
|
|
||||||
virtual void EnableOrientationChangeListener() override;
|
|
||||||
virtual void DisableOrientationChangeListener() override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void EnableTimeChangeNotifications() override;
|
|
||||||
virtual void DisableTimeChangeNotifications() override;
|
|
||||||
|
|
||||||
virtual nsresult SetArguments(nsIArray* aArguments) override;
|
virtual nsresult SetArguments(nsIArray* aArguments) override;
|
||||||
|
|
||||||
|
@ -555,7 +475,6 @@ public:
|
||||||
bool
|
bool
|
||||||
HadOriginalOpener() const
|
HadOriginalOpener() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsOuterWindow());
|
|
||||||
return mHadOriginalOpener;
|
return mHadOriginalOpener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +566,6 @@ public:
|
||||||
void GetNameOuter(nsAString& aName);
|
void GetNameOuter(nsAString& aName);
|
||||||
void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
|
void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
|
||||||
mozilla::dom::Location* GetLocation() override;
|
mozilla::dom::Location* GetLocation() override;
|
||||||
mozilla::dom::CustomElementRegistry* CustomElements() override;
|
|
||||||
void GetStatusOuter(nsAString& aStatus);
|
void GetStatusOuter(nsAString& aStatus);
|
||||||
void SetStatusOuter(const nsAString& aStatus);
|
void SetStatusOuter(const nsAString& aStatus);
|
||||||
void CloseOuter(bool aTrustedCaller);
|
void CloseOuter(bool aTrustedCaller);
|
||||||
|
@ -692,7 +610,6 @@ public:
|
||||||
bool aForceNoOpener,
|
bool aForceNoOpener,
|
||||||
nsPIDOMWindowOuter **_retval) override;
|
nsPIDOMWindowOuter **_retval) override;
|
||||||
nsIDOMNavigator* GetNavigator() override;
|
nsIDOMNavigator* GetNavigator() override;
|
||||||
already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
|
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_ANDROID)
|
#if defined(MOZ_WIDGET_ANDROID)
|
||||||
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
|
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
|
||||||
|
@ -717,9 +634,6 @@ public:
|
||||||
void PrintOuter(mozilla::ErrorResult& aError);
|
void PrintOuter(mozilla::ErrorResult& aError);
|
||||||
mozilla::dom::Selection* GetSelectionOuter();
|
mozilla::dom::Selection* GetSelectionOuter();
|
||||||
already_AddRefed<nsISelection> GetSelection() override;
|
already_AddRefed<nsISelection> GetSelection() override;
|
||||||
already_AddRefed<nsICSSDeclaration>
|
|
||||||
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
|
|
||||||
mozilla::ErrorResult& aError) override;
|
|
||||||
already_AddRefed<mozilla::dom::MediaQueryList> MatchMediaOuter(
|
already_AddRefed<mozilla::dom::MediaQueryList> MatchMediaOuter(
|
||||||
const nsAString& aQuery,
|
const nsAString& aQuery,
|
||||||
mozilla::dom::CallerType aCallerType);
|
mozilla::dom::CallerType aCallerType);
|
||||||
|
@ -784,7 +698,6 @@ public:
|
||||||
mozilla::ErrorResult& aError);
|
mozilla::ErrorResult& aError);
|
||||||
already_AddRefed<nsPIDOMWindowOuter> GetContent()
|
already_AddRefed<nsPIDOMWindowOuter> GetContent()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsOuterWindow());
|
|
||||||
mozilla::IgnoredErrorResult ignored;
|
mozilla::IgnoredErrorResult ignored;
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> win =
|
nsCOMPtr<nsPIDOMWindowOuter> win =
|
||||||
GetContentInternal(ignored, mozilla::dom::CallerType::System);
|
GetContentInternal(ignored, mozilla::dom::CallerType::System);
|
||||||
|
@ -1002,9 +915,6 @@ private:
|
||||||
void ReportLargeAllocStatus();
|
void ReportLargeAllocStatus();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual nsresult RegisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
|
|
||||||
virtual nsresult UnregisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
|
|
||||||
|
|
||||||
void FlushPendingNotifications(mozilla::FlushType aType);
|
void FlushPendingNotifications(mozilla::FlushType aType);
|
||||||
|
|
||||||
// Outer windows only.
|
// Outer windows only.
|
||||||
|
@ -1132,32 +1042,14 @@ private:
|
||||||
SecureContextFlags aFlags =
|
SecureContextFlags aFlags =
|
||||||
SecureContextFlags::eDefault);
|
SecureContextFlags::eDefault);
|
||||||
|
|
||||||
// nsPIDOMWindow<T> should be able to see these helper methods.
|
// nsPIDOMWindow{Inner,Outer} should be able to see these helper methods.
|
||||||
friend class nsPIDOMWindow<mozIDOMWindowProxy>;
|
|
||||||
friend class nsPIDOMWindow<mozIDOMWindow>;
|
|
||||||
friend class nsPIDOMWindow<nsISupports>;
|
|
||||||
friend class nsPIDOMWindowInner;
|
friend class nsPIDOMWindowInner;
|
||||||
friend class nsPIDOMWindowOuter;
|
friend class nsPIDOMWindowOuter;
|
||||||
|
|
||||||
mozilla::dom::TabGroup* TabGroupOuter();
|
mozilla::dom::TabGroup* TabGroupOuter();
|
||||||
|
|
||||||
bool IsBackgroundInternal() const;
|
|
||||||
|
|
||||||
void SetIsBackgroundInternal(bool aIsBackground);
|
void SetIsBackgroundInternal(bool aIsBackground);
|
||||||
|
|
||||||
// NOTE: Chrome Only
|
|
||||||
void DisconnectAndClearGroupMessageManagers()
|
|
||||||
{
|
|
||||||
MOZ_RELEASE_ASSERT(IsChromeWindow());
|
|
||||||
for (auto iter = mChromeFields.mGroupMessageManagers.Iter(); !iter.Done(); iter.Next()) {
|
|
||||||
nsIMessageBroadcaster* mm = iter.UserData();
|
|
||||||
if (mm) {
|
|
||||||
static_cast<nsFrameMessageManager*>(mm)->Disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mChromeFields.mGroupMessageManagers.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult GetInterfaceInternal(const nsIID& aIID, void** aSink);
|
nsresult GetInterfaceInternal(const nsIID& aIID, void** aSink);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -1171,17 +1063,9 @@ public:
|
||||||
virtual mozilla::AbstractThread*
|
virtual mozilla::AbstractThread*
|
||||||
AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
|
AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
|
||||||
|
|
||||||
uint32_t LastIdleRequestHandle() const { return mIdleRequestCallbackCounter - 1; }
|
|
||||||
nsresult RunIdleRequest(mozilla::dom::IdleRequest* aRequest,
|
|
||||||
DOMHighResTimeStamp aDeadline, bool aDidTimeout);
|
|
||||||
|
|
||||||
typedef mozilla::LinkedList<mozilla::dom::IdleRequest> IdleRequests;
|
typedef mozilla::LinkedList<mozilla::dom::IdleRequest> IdleRequests;
|
||||||
|
|
||||||
void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// These members are only used on outer window objects. Make sure
|
|
||||||
// you never set any of these on an inner object!
|
|
||||||
bool mFullScreen : 1;
|
bool mFullScreen : 1;
|
||||||
bool mFullscreenMode : 1;
|
bool mFullscreenMode : 1;
|
||||||
bool mIsClosed : 1;
|
bool mIsClosed : 1;
|
||||||
|
@ -1192,7 +1076,6 @@ protected:
|
||||||
bool mHavePendingClose : 1;
|
bool mHavePendingClose : 1;
|
||||||
bool mHadOriginalOpener : 1;
|
bool mHadOriginalOpener : 1;
|
||||||
bool mOriginalOpenerWasSecureContext : 1;
|
bool mOriginalOpenerWasSecureContext : 1;
|
||||||
bool mIsSecureContextIfOpenerIgnored : 1;
|
|
||||||
bool mIsPopupSpam : 1;
|
bool mIsPopupSpam : 1;
|
||||||
|
|
||||||
// Indicates whether scripts are allowed to close this window.
|
// Indicates whether scripts are allowed to close this window.
|
||||||
|
@ -1201,15 +1084,6 @@ protected:
|
||||||
// Window offline status. Checked to see if we need to fire offline event
|
// Window offline status. Checked to see if we need to fire offline event
|
||||||
bool mWasOffline : 1;
|
bool mWasOffline : 1;
|
||||||
|
|
||||||
// Represents whether the inner window's page has had a slow script notice.
|
|
||||||
// Only used by inner windows; will always be false for outer windows.
|
|
||||||
// This is used to implement Telemetry measures such as SLOW_SCRIPT_PAGE_COUNT.
|
|
||||||
bool mHasHadSlowScript : 1;
|
|
||||||
|
|
||||||
// Track what sorts of events we need to fire when thawed
|
|
||||||
bool mNotifyIdleObserversIdleOnThaw : 1;
|
|
||||||
bool mNotifyIdleObserversActiveOnThaw : 1;
|
|
||||||
|
|
||||||
// Indicates whether we're in the middle of creating an initializing
|
// Indicates whether we're in the middle of creating an initializing
|
||||||
// a new inner window object.
|
// a new inner window object.
|
||||||
bool mCreatingInnerWindow : 1;
|
bool mCreatingInnerWindow : 1;
|
||||||
|
@ -1217,41 +1091,6 @@ protected:
|
||||||
// Fast way to tell if this is a chrome window (without having to QI).
|
// Fast way to tell if this is a chrome window (without having to QI).
|
||||||
bool mIsChrome : 1;
|
bool mIsChrome : 1;
|
||||||
|
|
||||||
// Hack to indicate whether a chrome window needs its message manager
|
|
||||||
// to be disconnected, since clean up code is shared in the global
|
|
||||||
// window superclass.
|
|
||||||
bool mCleanMessageManager : 1;
|
|
||||||
|
|
||||||
// Indicates that the current document has never received a document focus
|
|
||||||
// event.
|
|
||||||
bool mNeedsFocus : 1;
|
|
||||||
bool mHasFocus : 1;
|
|
||||||
|
|
||||||
// when true, show focus rings for the current focused content only.
|
|
||||||
// This will be reset when another element is focused
|
|
||||||
bool mShowFocusRingForContent : 1;
|
|
||||||
|
|
||||||
// true if tab navigation has occurred for this window. Focus rings
|
|
||||||
// should be displayed.
|
|
||||||
bool mFocusByKeyOccurred : 1;
|
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
// Indicates whether this window wants gamepad input events
|
|
||||||
bool mHasGamepad : 1;
|
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
// Indicates whether this window wants VR events
|
|
||||||
bool mHasVREvents : 1;
|
|
||||||
|
|
||||||
// Inner windows only.
|
|
||||||
// Indicates whether this window wants VRDisplayActivate events
|
|
||||||
bool mHasVRDisplayActivateEvents : 1;
|
|
||||||
nsCheapSet<nsUint32HashKey> mGamepadIndexSet;
|
|
||||||
nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
|
|
||||||
bool mHasSeenGamepadInput;
|
|
||||||
|
|
||||||
// whether we've sent the destroy notification for our window id
|
|
||||||
bool mNotifiedIDDestroyed : 1;
|
|
||||||
// whether scripts may close the window,
|
// whether scripts may close the window,
|
||||||
// even if "dom.allow_scripts_to_close_windows" is false.
|
// even if "dom.allow_scripts_to_close_windows" is false.
|
||||||
bool mAllowScriptsToClose : 1;
|
bool mAllowScriptsToClose : 1;
|
||||||
|
@ -1265,64 +1104,18 @@ protected:
|
||||||
// For |window.arguments|, via |openDialog|.
|
// For |window.arguments|, via |openDialog|.
|
||||||
nsCOMPtr<nsIArray> mArguments;
|
nsCOMPtr<nsIArray> mArguments;
|
||||||
|
|
||||||
// Only used in the outer.
|
|
||||||
RefPtr<DialogValueHolder> mReturnValue;
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::Navigator> mNavigator;
|
|
||||||
RefPtr<nsScreen> mScreen;
|
|
||||||
RefPtr<nsDOMWindowList> mFrames;
|
RefPtr<nsDOMWindowList> mFrames;
|
||||||
// All BarProps are inner window only.
|
|
||||||
RefPtr<mozilla::dom::BarProp> mMenubar;
|
|
||||||
RefPtr<mozilla::dom::BarProp> mToolbar;
|
|
||||||
RefPtr<mozilla::dom::BarProp> mLocationbar;
|
|
||||||
RefPtr<mozilla::dom::BarProp> mPersonalbar;
|
|
||||||
RefPtr<mozilla::dom::BarProp> mStatusbar;
|
|
||||||
RefPtr<mozilla::dom::BarProp> mScrollbars;
|
|
||||||
RefPtr<nsDOMWindowUtils> mWindowUtils;
|
RefPtr<nsDOMWindowUtils> mWindowUtils;
|
||||||
nsString mStatus;
|
nsString mStatus;
|
||||||
nsString mDefaultStatus;
|
|
||||||
RefPtr<nsGlobalWindowObserver> mObserver; // Inner windows only.
|
|
||||||
RefPtr<mozilla::dom::Crypto> mCrypto;
|
|
||||||
RefPtr<mozilla::dom::U2F> mU2F;
|
|
||||||
RefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
|
|
||||||
RefPtr<mozilla::dom::Console> mConsole;
|
|
||||||
RefPtr<mozilla::dom::Worklet> mAudioWorklet;
|
|
||||||
RefPtr<mozilla::dom::Worklet> mPaintWorklet;
|
|
||||||
// We need to store an nsISupports pointer to this object because the
|
|
||||||
// mozilla::dom::External class doesn't exist on b2g and using the type
|
|
||||||
// forward declared here means that ~nsGlobalWindow wouldn't compile because
|
|
||||||
// it wouldn't see the ~External function's declaration.
|
|
||||||
nsCOMPtr<nsISupports> mExternal;
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::MozSelfSupport> mMozSelfSupport;
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
||||||
RefPtr<mozilla::dom::Storage> mSessionStorage;
|
|
||||||
|
|
||||||
// These member variable are used only on inner windows.
|
|
||||||
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
|
||||||
RefPtr<mozilla::dom::Location> mLocation;
|
|
||||||
RefPtr<nsHistory> mHistory;
|
|
||||||
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
|
||||||
|
|
||||||
// These member variables are used on both inner and the outer windows.
|
|
||||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
||||||
// mTabChild is only ever populated in the content process.
|
// mTabChild is only ever populated in the content process.
|
||||||
nsCOMPtr<nsITabChild> mTabChild;
|
nsCOMPtr<nsITabChild> mTabChild;
|
||||||
|
|
||||||
uint32_t mSuspendDepth;
|
|
||||||
uint32_t mFreezeDepth;
|
|
||||||
|
|
||||||
// the method that was used to focus mFocusedNode
|
|
||||||
uint32_t mFocusMethod;
|
|
||||||
|
|
||||||
uint32_t mSerial;
|
uint32_t mSerial;
|
||||||
|
|
||||||
// The current idle request callback handle
|
|
||||||
uint32_t mIdleRequestCallbackCounter;
|
|
||||||
IdleRequests mIdleRequestCallbacks;
|
|
||||||
RefPtr<IdleRequestExecutor> mIdleRequestExecutor;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool mSetOpenerWindowCalled;
|
bool mSetOpenerWindowCalled;
|
||||||
nsCOMPtr<nsIURI> mLastOpenedURI;
|
nsCOMPtr<nsIURI> mLastOpenedURI;
|
||||||
|
@ -1330,50 +1123,13 @@ protected:
|
||||||
|
|
||||||
bool mCleanedUp;
|
bool mCleanedUp;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
// It's useful when we get matched EnterModalState/LeaveModalState calls, in
|
||||||
|
// which case the outer window is responsible for unsuspending events on the
|
||||||
using XBLPrototypeHandlerTable = nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>;
|
// document. If we don't (for example, if the outer window is closed before
|
||||||
mozilla::UniquePtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers;
|
// the LeaveModalState call), then the inner window whose mDoc is our
|
||||||
|
// mSuspendedDoc is responsible for unsuspending it.
|
||||||
// mSuspendedDoc is only set on outer windows. It's useful when we get matched
|
|
||||||
// EnterModalState/LeaveModalState calls, in which case the outer window is
|
|
||||||
// responsible for unsuspending events on the document. If we don't (for
|
|
||||||
// example, if the outer window is closed before the LeaveModalState call),
|
|
||||||
// then the inner window whose mDoc is our mSuspendedDoc is responsible for
|
|
||||||
// unsuspending it.
|
|
||||||
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
||||||
|
|
||||||
RefPtr<mozilla::dom::IDBFactory> mIndexedDB;
|
|
||||||
|
|
||||||
// This counts the number of windows that have been opened in rapid succession
|
|
||||||
// (i.e. within dom.successive_dialog_time_limit of each other). It is reset
|
|
||||||
// to 0 once a dialog is opened after dom.successive_dialog_time_limit seconds
|
|
||||||
// have elapsed without any other dialogs.
|
|
||||||
uint32_t mDialogAbuseCount;
|
|
||||||
|
|
||||||
// This holds the time when the last modal dialog was shown. If more than
|
|
||||||
// MAX_DIALOG_LIMIT dialogs are shown within the time span defined by
|
|
||||||
// dom.successive_dialog_time_limit, we show a checkbox or confirmation prompt
|
|
||||||
// to allow disabling of further dialogs from this window.
|
|
||||||
TimeStamp mLastDialogQuitTime;
|
|
||||||
|
|
||||||
// This flag keeps track of whether dialogs are
|
|
||||||
// currently enabled on this window.
|
|
||||||
bool mAreDialogsEnabled;
|
|
||||||
|
|
||||||
nsTHashtable<nsPtrHashKey<mozilla::DOMEventTargetHelper> > mEventTargetObjects;
|
|
||||||
|
|
||||||
nsTArray<uint32_t> mEnabledSensors;
|
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_ANDROID)
|
|
||||||
mozilla::UniquePtr<mozilla::dom::WindowOrientationObserver> mOrientationChangeObserver;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MOZ_WEBSPEECH
|
|
||||||
// mSpeechSynthesis is only used on inner windows.
|
|
||||||
RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// This member is used in the debug only assertions in TabGroup()
|
// This member is used in the debug only assertions in TabGroup()
|
||||||
// to catch cyclic parent/opener trees and not overflow the stack.
|
// to catch cyclic parent/opener trees and not overflow the stack.
|
||||||
|
@ -1383,36 +1139,21 @@ protected:
|
||||||
// This is the CC generation the last time we called CanSkip.
|
// This is the CC generation the last time we called CanSkip.
|
||||||
uint32_t mCanSkipCCGeneration;
|
uint32_t mCanSkipCCGeneration;
|
||||||
|
|
||||||
// The VR Displays for this window
|
|
||||||
nsTArray<RefPtr<mozilla::dom::VRDisplay>> mVRDisplays;
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::VREventObserver> mVREventObserver;
|
|
||||||
|
|
||||||
// When non-zero, the document should receive a vrdisplayactivate event
|
// When non-zero, the document should receive a vrdisplayactivate event
|
||||||
// after loading. The value is the ID of the VRDisplay that content should
|
// after loading. The value is the ID of the VRDisplay that content should
|
||||||
// begin presentation on.
|
// begin presentation on.
|
||||||
uint32_t mAutoActivateVRDisplayID; // Outer windows only
|
uint32_t mAutoActivateVRDisplayID;
|
||||||
int64_t mBeforeUnloadListenerCount; // Inner windows only
|
|
||||||
|
|
||||||
RefPtr<mozilla::dom::IntlUtils> mIntlUtils;
|
|
||||||
|
|
||||||
static OuterWindowByIdTable* sOuterWindowsById;
|
static OuterWindowByIdTable* sOuterWindowsById;
|
||||||
|
|
||||||
// Members in the mChromeFields member should only be used in chrome windows.
|
// Members in the mChromeFields member should only be used in chrome windows.
|
||||||
// All accesses to this field should be guarded by a check of mIsChrome.
|
// All accesses to this field should be guarded by a check of mIsChrome.
|
||||||
struct ChromeFields {
|
struct ChromeFields {
|
||||||
ChromeFields()
|
|
||||||
: mGroupMessageManagers(1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||||
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
|
||||||
nsInterfaceHashtable<nsStringHashKey, nsIMessageBroadcaster> mGroupMessageManagers;
|
|
||||||
// A weak pointer to the nsPresShell that we are doing fullscreen for.
|
// A weak pointer to the nsPresShell that we are doing fullscreen for.
|
||||||
// The pointer being set indicates we've set the IsInFullscreenChange
|
// The pointer being set indicates we've set the IsInFullscreenChange
|
||||||
// flag on this pres shell.
|
// flag on this pres shell.
|
||||||
nsWeakPtr mFullscreenPresShell;
|
nsWeakPtr mFullscreenPresShell;
|
||||||
nsCOMPtr<mozIDOMWindowProxy> mOpenerForInitialContentBrowser;
|
|
||||||
} mChromeFields;
|
} mChromeFields;
|
||||||
|
|
||||||
friend class nsDOMScriptableHelper;
|
friend class nsDOMScriptableHelper;
|
||||||
|
@ -1465,10 +1206,6 @@ nsGlobalWindowOuter::GetScriptableTopInternal()
|
||||||
inline nsIScriptContext*
|
inline nsIScriptContext*
|
||||||
nsGlobalWindowOuter::GetContextInternal()
|
nsGlobalWindowOuter::GetContextInternal()
|
||||||
{
|
{
|
||||||
if (mOuterWindow) {
|
|
||||||
return GetOuterWindowInternal()->mContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mContext;
|
return mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1481,7 +1218,6 @@ nsGlobalWindowOuter::GetOuterWindowInternal()
|
||||||
inline nsGlobalWindowInner*
|
inline nsGlobalWindowInner*
|
||||||
nsGlobalWindowOuter::GetCurrentInnerWindowInternal() const
|
nsGlobalWindowOuter::GetCurrentInnerWindowInternal() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsOuterWindow());
|
|
||||||
return nsGlobalWindowInner::Cast(mInnerWindow);
|
return nsGlobalWindowInner::Cast(mInnerWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1494,7 +1230,6 @@ nsGlobalWindowOuter::EnsureInnerWindowInternal()
|
||||||
inline bool
|
inline bool
|
||||||
nsGlobalWindowOuter::IsTopLevelWindow()
|
nsGlobalWindowOuter::IsTopLevelWindow()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsOuterWindow());
|
|
||||||
nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
|
nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
|
||||||
return parentWindow == this->AsOuter();
|
return parentWindow == this->AsOuter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ NS_INTERFACE_MAP_END
|
||||||
nsHistory::nsHistory(nsPIDOMWindowInner* aInnerWindow)
|
nsHistory::nsHistory(nsPIDOMWindowInner* aInnerWindow)
|
||||||
: mInnerWindow(do_GetWeakReference(aInnerWindow))
|
: mInnerWindow(do_GetWeakReference(aInnerWindow))
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aInnerWindow->IsInnerWindow());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHistory::~nsHistory()
|
nsHistory::~nsHistory()
|
||||||
|
|
|
@ -900,6 +900,15 @@ public:
|
||||||
mBufferedCSPViolations.AppendElement(aReportingRunnable, mozilla::fallible);
|
mBufferedCSPViolations.AppendElement(aReportingRunnable, mozilla::fallible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the document was decoded as UTF-8 and decoder encountered no
|
||||||
|
* errors.
|
||||||
|
*/
|
||||||
|
void DisableEncodingMenu()
|
||||||
|
{
|
||||||
|
mEncodingMenuDisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access HTTP header data (this may also get set from other
|
* Access HTTP header data (this may also get set from other
|
||||||
* sources, like HTML META tags).
|
* sources, like HTML META tags).
|
||||||
|
@ -3592,6 +3601,9 @@ protected:
|
||||||
// True if the document is allowed to use PaymentRequest.
|
// True if the document is allowed to use PaymentRequest.
|
||||||
bool mAllowPaymentRequest : 1;
|
bool mAllowPaymentRequest : 1;
|
||||||
|
|
||||||
|
// True if the encoding menu should be disabled.
|
||||||
|
bool mEncodingMenuDisabled : 1;
|
||||||
|
|
||||||
// Whether <style scoped> support is enabled in this document.
|
// Whether <style scoped> support is enabled in this document.
|
||||||
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
|
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
|
||||||
unsigned int mIsScopedStyleEnabled : 2;
|
unsigned int mIsScopedStyleEnabled : 2;
|
||||||
|
|
|
@ -230,7 +230,6 @@ nsInProcessTabChildGlobal::DisconnectEventListeners()
|
||||||
{
|
{
|
||||||
if (mDocShell) {
|
if (mDocShell) {
|
||||||
if (nsCOMPtr<nsPIDOMWindowOuter> win = mDocShell->GetWindow()) {
|
if (nsCOMPtr<nsPIDOMWindowOuter> win = mDocShell->GetWindow()) {
|
||||||
MOZ_ASSERT(win->IsOuterWindow());
|
|
||||||
win->SetChromeEventHandler(win->GetChromeEventHandler());
|
win->SetChromeEventHandler(win->GetChromeEventHandler());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -4,54 +4,23 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
template<class T>
|
|
||||||
nsPIDOMWindowInner*
|
|
||||||
nsPIDOMWindow<T>::AsInner()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsInnerWindow());
|
|
||||||
return reinterpret_cast<nsPIDOMWindowInner*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
const nsPIDOMWindowInner*
|
|
||||||
nsPIDOMWindow<T>::AsInner() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsInnerWindow());
|
|
||||||
return reinterpret_cast<const nsPIDOMWindowInner*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
nsPIDOMWindowOuter*
|
|
||||||
nsPIDOMWindow<T>::AsOuter()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsOuterWindow());
|
|
||||||
return reinterpret_cast<nsPIDOMWindowOuter*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
const nsPIDOMWindowOuter*
|
|
||||||
nsPIDOMWindow<T>::AsOuter() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsOuterWindow());
|
|
||||||
return reinterpret_cast<const nsPIDOMWindowOuter*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool
|
bool
|
||||||
nsPIDOMWindow<T>::IsLoading() const
|
nsPIDOMWindowOuter::IsLoading() const
|
||||||
{
|
{
|
||||||
if (IsOuterWindow()) {
|
auto* win = GetCurrentInnerWindow();
|
||||||
auto* win = AsOuter()->GetCurrentInnerWindow();
|
|
||||||
|
|
||||||
if (!win) {
|
if (!win) {
|
||||||
NS_ERROR("No current inner window available!");
|
NS_ERROR("No current inner window available!");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return win->IsLoading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return win->IsLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsPIDOMWindowInner::IsLoading() const
|
||||||
|
{
|
||||||
if (!mOuterWindow) {
|
if (!mOuterWindow) {
|
||||||
NS_ERROR("IsLoading() called on orphan inner window!");
|
NS_ERROR("IsLoading() called on orphan inner window!");
|
||||||
|
|
||||||
|
@ -61,22 +30,23 @@ nsPIDOMWindow<T>::IsLoading() const
|
||||||
return !mIsDocumentLoaded;
|
return !mIsDocumentLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool
|
bool
|
||||||
nsPIDOMWindow<T>::IsHandlingResizeEvent() const
|
nsPIDOMWindowOuter::IsHandlingResizeEvent() const
|
||||||
{
|
{
|
||||||
if (IsOuterWindow()) {
|
auto* win = GetCurrentInnerWindow();
|
||||||
auto* win = AsOuter()->GetCurrentInnerWindow();
|
|
||||||
|
|
||||||
if (!win) {
|
if (!win) {
|
||||||
NS_ERROR("No current inner window available!");
|
NS_ERROR("No current inner window available!");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return win->IsHandlingResizeEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return win->IsHandlingResizeEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsPIDOMWindowInner::IsHandlingResizeEvent() const
|
||||||
|
{
|
||||||
if (!mOuterWindow) {
|
if (!mOuterWindow) {
|
||||||
NS_ERROR("IsHandlingResizeEvent() called on orphan inner window!");
|
NS_ERROR("IsHandlingResizeEvent() called on orphan inner window!");
|
||||||
|
|
||||||
|
@ -107,24 +77,26 @@ nsPIDOMWindowInner::IsTopInnerWindow() const
|
||||||
return mTopInnerWindow == this;
|
return mTopInnerWindow == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
nsIDocShell*
|
nsIDocShell*
|
||||||
nsPIDOMWindow<T>::GetDocShell() const
|
nsPIDOMWindowOuter::GetDocShell() const
|
||||||
{
|
{
|
||||||
if (mOuterWindow) {
|
|
||||||
return mOuterWindow->GetDocShell();
|
|
||||||
}
|
|
||||||
|
|
||||||
return mDocShell;
|
return mDocShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
nsIDocShell*
|
||||||
nsIContent*
|
nsPIDOMWindowInner::GetDocShell() const
|
||||||
nsPIDOMWindow<T>::GetFocusedNode() const
|
|
||||||
{
|
{
|
||||||
if (IsOuterWindow()) {
|
return mOuterWindow ? mOuterWindow->GetDocShell() : nullptr;
|
||||||
return mInnerWindow ? mInnerWindow->GetFocusedNode() : nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
nsIContent*
|
||||||
|
nsPIDOMWindowOuter::GetFocusedNode() const
|
||||||
|
{
|
||||||
|
return mInnerWindow ? mInnerWindow->GetFocusedNode() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIContent*
|
||||||
|
nsPIDOMWindowInner::GetFocusedNode() const
|
||||||
|
{
|
||||||
return mFocusedNode;
|
return mFocusedNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ using namespace mozilla::dom;
|
||||||
nsScreen::Create(nsPIDOMWindowInner* aWindow)
|
nsScreen::Create(nsPIDOMWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
if (!aWindow->GetDocShell()) {
|
if (!aWindow->GetDocShell()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -36,7 +36,6 @@ using namespace mozilla::dom;
|
||||||
nsWindowRoot::nsWindowRoot(nsPIDOMWindowOuter* aWindow)
|
nsWindowRoot::nsWindowRoot(nsPIDOMWindowOuter* aWindow)
|
||||||
{
|
{
|
||||||
mWindow = aWindow;
|
mWindow = aWindow;
|
||||||
MOZ_ASSERT(mWindow->IsOuterWindow());
|
|
||||||
|
|
||||||
// Keyboard indicators are not shown on Mac by default.
|
// Keyboard indicators are not shown on Mac by default.
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
|
|
|
@ -186,7 +186,6 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||||
? xpc::WindowGlobalOrNull(realCallback)
|
? xpc::WindowGlobalOrNull(realCallback)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
if (win) {
|
if (win) {
|
||||||
MOZ_ASSERT(win->IsInnerWindow());
|
|
||||||
// We don't want to run script in windows that have been navigated away
|
// We don't want to run script in windows that have been navigated away
|
||||||
// from.
|
// from.
|
||||||
if (!win->AsInner()->HasActiveDocument()) {
|
if (!win->AsInner()->HasActiveDocument()) {
|
||||||
|
|
|
@ -363,7 +363,6 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
|
||||||
|
|
||||||
if (!workerPrivate) {
|
if (!workerPrivate) {
|
||||||
MOZ_ASSERT(window);
|
MOZ_ASSERT(window);
|
||||||
MOZ_ASSERT(window->IsInnerWindow());
|
|
||||||
bc->mInnerID = window->WindowID();
|
bc->mInnerID = window->WindowID();
|
||||||
|
|
||||||
// Register as observer for inner-window-destroyed.
|
// Register as observer for inner-window-destroyed.
|
||||||
|
|
|
@ -5506,8 +5506,6 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow, double aX,
|
||||||
const nsAString& aBgColor,
|
const nsAString& aBgColor,
|
||||||
uint32_t aFlags, ErrorResult& aError)
|
uint32_t aFlags, ErrorResult& aError)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow.IsInnerWindow());
|
|
||||||
|
|
||||||
if (int32_t(aW) == 0 || int32_t(aH) == 0) {
|
if (int32_t(aW) == 0 || int32_t(aH) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,7 +380,6 @@ protected:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
nsPIDOMWindowOuter* outerWindow = aWindow->GetOuterWindow();
|
nsPIDOMWindowOuter* outerWindow = aWindow->GetOuterWindow();
|
||||||
if (NS_WARN_IF(!outerWindow)) {
|
if (NS_WARN_IF(!outerWindow)) {
|
||||||
return;
|
return;
|
||||||
|
@ -822,7 +821,6 @@ Console::Console(nsPIDOMWindowInner* aWindow)
|
||||||
MOZ_ASSERT_IF(NS_IsMainThread(), aWindow);
|
MOZ_ASSERT_IF(NS_IsMainThread(), aWindow);
|
||||||
|
|
||||||
if (mWindow) {
|
if (mWindow) {
|
||||||
MOZ_ASSERT(mWindow->IsInnerWindow());
|
|
||||||
mInnerID = mWindow->WindowID();
|
mInnerID = mWindow->WindowID();
|
||||||
|
|
||||||
// Without outerwindow any console message coming from this object will not
|
// Without outerwindow any console message coming from this object will not
|
||||||
|
|
|
@ -810,12 +810,6 @@ EventListenerManager::SetEventHandler(nsAtom* aName,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
if (nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(global)) {
|
|
||||||
MOZ_ASSERT(win->IsInnerWindow(), "We should not have an outer window here!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
// return early preventing the event listener from being added
|
// return early preventing the event listener from being added
|
||||||
// 'doc' is fetched above
|
// 'doc' is fetched above
|
||||||
|
|
|
@ -98,15 +98,6 @@ Blob::Blob(nsISupports* aParent, BlobImpl* aImpl)
|
||||||
, mParent(aParent)
|
, mParent(aParent)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mImpl);
|
MOZ_ASSERT(mImpl);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aParent);
|
|
||||||
if (win) {
|
|
||||||
MOZ_ASSERT(win->IsInnerWindow());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Blob::~Blob()
|
Blob::~Blob()
|
||||||
|
|
|
@ -135,7 +135,6 @@ void
|
||||||
GamepadManager::AddListener(nsGlobalWindowInner* aWindow)
|
GamepadManager::AddListener(nsGlobalWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
// IPDL child has not been created
|
// IPDL child has not been created
|
||||||
|
@ -181,7 +180,6 @@ void
|
||||||
GamepadManager::RemoveListener(nsGlobalWindowInner* aWindow)
|
GamepadManager::RemoveListener(nsGlobalWindowInner* aWindow)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
if (mShuttingDown) {
|
if (mShuttingDown) {
|
||||||
// Doesn't matter at this point. It's possible we're being called
|
// Doesn't matter at this point. It's possible we're being called
|
||||||
|
@ -353,9 +351,6 @@ GamepadManager::NewConnectionEvent(uint32_t aIndex, bool aConnected)
|
||||||
|
|
||||||
if (aConnected) {
|
if (aConnected) {
|
||||||
for (uint32_t i = 0; i < listeners.Length(); i++) {
|
for (uint32_t i = 0; i < listeners.Length(); i++) {
|
||||||
|
|
||||||
MOZ_ASSERT(listeners[i]->IsInnerWindow());
|
|
||||||
|
|
||||||
// Only send events to non-background windows
|
// Only send events to non-background windows
|
||||||
if (!listeners[i]->AsInner()->IsCurrentInnerWindow() ||
|
if (!listeners[i]->AsInner()->IsCurrentInnerWindow() ||
|
||||||
listeners[i]->GetOuterWindow()->IsBackground()) {
|
listeners[i]->GetOuterWindow()->IsBackground()) {
|
||||||
|
@ -492,7 +487,6 @@ GamepadManager::SetWindowHasSeenGamepad(nsGlobalWindowInner* aWindow,
|
||||||
bool aHasSeen)
|
bool aHasSeen)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
if (mListeners.IndexOf(aWindow) == NoIndex) {
|
if (mListeners.IndexOf(aWindow) == NoIndex) {
|
||||||
// This window isn't even listening for gamepad events.
|
// This window isn't even listening for gamepad events.
|
||||||
|
@ -549,8 +543,6 @@ GamepadManager::Update(const GamepadChangeEvent& aEvent)
|
||||||
nsTArray<RefPtr<nsGlobalWindowInner>> listeners(mListeners);
|
nsTArray<RefPtr<nsGlobalWindowInner>> listeners(mListeners);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < listeners.Length(); i++) {
|
for (uint32_t i = 0; i < listeners.Length(); i++) {
|
||||||
MOZ_ASSERT(listeners[i]->IsInnerWindow());
|
|
||||||
|
|
||||||
// Only send events to non-background windows
|
// Only send events to non-background windows
|
||||||
if (!listeners[i]->AsInner()->IsCurrentInnerWindow() ||
|
if (!listeners[i]->AsInner()->IsCurrentInnerWindow() ||
|
||||||
listeners[i]->GetOuterWindow()->IsBackground()) {
|
listeners[i]->GetOuterWindow()->IsBackground()) {
|
||||||
|
|
|
@ -129,9 +129,6 @@ nsGenericHTMLFrameElement::GetContentWindow()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(win->IsOuterWindow(),
|
|
||||||
"Uh, this window should always be an outer window!");
|
|
||||||
|
|
||||||
return win.forget();
|
return win.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3665,6 +3665,9 @@ nsHTMLDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
|
||||||
bool
|
bool
|
||||||
nsHTMLDocument::WillIgnoreCharsetOverride()
|
nsHTMLDocument::WillIgnoreCharsetOverride()
|
||||||
{
|
{
|
||||||
|
if (mEncodingMenuDisabled) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (mType != eHTML) {
|
if (mType != eHTML) {
|
||||||
MOZ_ASSERT(mType == eXHTML);
|
MOZ_ASSERT(mType == eXHTML);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -32,20 +32,4 @@ interface nsIDOMChromeWindow : nsISupports
|
||||||
*/
|
*/
|
||||||
[noscript]
|
[noscript]
|
||||||
nsIMessageBroadcaster getGroupMessageManager(in AString group);
|
nsIMessageBroadcaster getGroupMessageManager(in AString group);
|
||||||
|
|
||||||
/**
|
|
||||||
* These methods provide a way to specify the opener value for the content in
|
|
||||||
* the window before the content itself is created. This is important in order
|
|
||||||
* to set the DocGroup of a document, as the opener must be set before the
|
|
||||||
* document is created.
|
|
||||||
*
|
|
||||||
* SetOpenerForInitialContentBrowser is used to set which opener will be used,
|
|
||||||
* and TakeOpenerForInitialContentBrowser is used by nsXULElement in order to
|
|
||||||
* take the value set earlier, and null out the value in the
|
|
||||||
* nsIDOMChromeWindow.
|
|
||||||
*/
|
|
||||||
[noscript]
|
|
||||||
void setOpenerForInitialContentBrowser(in mozIDOMWindowProxy aOpener);
|
|
||||||
[noscript]
|
|
||||||
mozIDOMWindowProxy takeOpenerForInitialContentBrowser();
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1248,7 +1248,6 @@ MediaRecorder::MediaRecorder(DOMMediaStream& aSourceMediaStream,
|
||||||
, mState(RecordingState::Inactive)
|
, mState(RecordingState::Inactive)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aOwnerWindow);
|
MOZ_ASSERT(aOwnerWindow);
|
||||||
MOZ_ASSERT(aOwnerWindow->IsInnerWindow());
|
|
||||||
mDOMStream = &aSourceMediaStream;
|
mDOMStream = &aSourceMediaStream;
|
||||||
|
|
||||||
RegisterActivityObserver();
|
RegisterActivityObserver();
|
||||||
|
@ -1262,7 +1261,6 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode,
|
||||||
, mState(RecordingState::Inactive)
|
, mState(RecordingState::Inactive)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aOwnerWindow);
|
MOZ_ASSERT(aOwnerWindow);
|
||||||
MOZ_ASSERT(aOwnerWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
mAudioNode = &aSrcAudioNode;
|
mAudioNode = &aSrcAudioNode;
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,6 @@ SpeechRecognition::Constructor(const GlobalObject& aGlobal,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(win->IsInnerWindow());
|
|
||||||
RefPtr<SpeechRecognition> object = new SpeechRecognition(win);
|
RefPtr<SpeechRecognition> object = new SpeechRecognition(win);
|
||||||
return object.forget();
|
return object.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ SpeechSynthesis::SpeechSynthesis(nsPIDOMWindowInner* aParent)
|
||||||
, mHoldQueue(false)
|
, mHoldQueue(false)
|
||||||
, mInnerID(aParent->WindowID())
|
, mInnerID(aParent->WindowID())
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aParent->IsInnerWindow());
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||||
|
|
|
@ -72,7 +72,6 @@ SpeechSynthesisUtterance::Constructor(GlobalObject& aGlobal,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(win->IsInnerWindow());
|
|
||||||
RefPtr<SpeechSynthesisUtterance> object =
|
RefPtr<SpeechSynthesisUtterance> object =
|
||||||
new SpeechSynthesisUtterance(win, aText);
|
new SpeechSynthesisUtterance(win, aText);
|
||||||
return object.forget();
|
return object.forget();
|
||||||
|
|
|
@ -337,7 +337,6 @@ MessagePort::Initialize(const nsID& aUUID,
|
||||||
mWorkerHolder = Move(workerHolder);
|
mWorkerHolder = Move(workerHolder);
|
||||||
} else if (GetOwner()) {
|
} else if (GetOwner()) {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(GetOwner()->IsInnerWindow());
|
|
||||||
mInnerID = GetOwner()->WindowID();
|
mInnerID = GetOwner()->WindowID();
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||||
|
|
|
@ -123,7 +123,6 @@ UDPSocket::UDPSocket(nsPIDOMWindowInner* aOwner,
|
||||||
, mReadyState(SocketReadyState::Opening)
|
, mReadyState(SocketReadyState::Opening)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aOwner);
|
MOZ_ASSERT(aOwner);
|
||||||
MOZ_ASSERT(aOwner->IsInnerWindow());
|
|
||||||
|
|
||||||
nsIDocument* aDoc = aOwner->GetExtantDoc();
|
nsIDocument* aDoc = aOwner->GetExtantDoc();
|
||||||
if (aDoc) {
|
if (aDoc) {
|
||||||
|
|
|
@ -82,7 +82,6 @@ PerformanceObserver::Constructor(const GlobalObject& aGlobal,
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(ownerWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
RefPtr<PerformanceObserver> observer =
|
RefPtr<PerformanceObserver> observer =
|
||||||
new PerformanceObserver(ownerWindow, aCb);
|
new PerformanceObserver(ownerWindow, aCb);
|
||||||
|
|
|
@ -38,11 +38,17 @@ Storage::Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal)
|
||||||
Storage::~Storage()
|
Storage::~Storage()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/* static */ bool
|
||||||
|
Storage::StoragePrefIsEnabled()
|
||||||
|
{
|
||||||
|
return mozilla::Preferences::GetBool(kStorageEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Storage::CanUseStorage(nsIPrincipal& aSubjectPrincipal)
|
Storage::CanUseStorage(nsIPrincipal& aSubjectPrincipal)
|
||||||
{
|
{
|
||||||
// This method is responsible for correct setting of mIsSessionOnly.
|
// This method is responsible for correct setting of mIsSessionOnly.
|
||||||
if (!mozilla::Preferences::GetBool(kStorageEnabled)) {
|
if (!StoragePrefIsEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
|
|
||||||
Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal);
|
Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal);
|
||||||
|
|
||||||
|
static bool StoragePrefIsEnabled();
|
||||||
|
|
||||||
enum StorageType {
|
enum StorageType {
|
||||||
eSessionStorage,
|
eSessionStorage,
|
||||||
eLocalStorage,
|
eLocalStorage,
|
||||||
|
|
|
@ -27,7 +27,7 @@ VREventObserver::VREventObserver(nsGlobalWindowInner* aGlobalWindow)
|
||||||
, mIs2DView(true)
|
, mIs2DView(true)
|
||||||
, mHasReset(false)
|
, mHasReset(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobalWindow && aGlobalWindow->IsInnerWindow());
|
MOZ_ASSERT(aGlobalWindow);
|
||||||
|
|
||||||
UpdateSpentTimeIn2DTelemetry(false);
|
UpdateSpentTimeIn2DTelemetry(false);
|
||||||
VRManagerChild* vmc = VRManagerChild::Get();
|
VRManagerChild* vmc = VRManagerChild::Get();
|
||||||
|
|
|
@ -1278,8 +1278,6 @@ WebSocket::ConstructorCommon(const GlobalObject& aGlobal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT_IF(ownerWindow, ownerWindow->IsInnerWindow());
|
|
||||||
|
|
||||||
nsTArray<nsString> protocolArray;
|
nsTArray<nsString> protocolArray;
|
||||||
|
|
||||||
for (uint32_t index = 0, len = aProtocols.Length(); index < len; ++index) {
|
for (uint32_t index = 0, len = aProtocols.Length(); index < len; ++index) {
|
||||||
|
|
|
@ -382,7 +382,6 @@ public:
|
||||||
MOZ_ASSERT(aPromiseProxy);
|
MOZ_ASSERT(aPromiseProxy);
|
||||||
MOZ_ASSERT(aServiceWorkerPrivate);
|
MOZ_ASSERT(aServiceWorkerPrivate);
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
|
||||||
MOZ_ASSERT(aBaseURI);
|
MOZ_ASSERT(aBaseURI);
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,6 @@ ServiceWorkerRegistrationMainThread::ServiceWorkerRegistrationMainThread(nsPIDOM
|
||||||
{
|
{
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
|
||||||
StartListeningForEvents();
|
StartListeningForEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,6 @@ public:
|
||||||
MOZ_ASSERT(aPromiseProxy);
|
MOZ_ASSERT(aPromiseProxy);
|
||||||
MOZ_ASSERT(aServiceWorkerPrivate);
|
MOZ_ASSERT(aServiceWorkerPrivate);
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
MOZ_ASSERT(aWindow->IsOuterWindow());
|
|
||||||
MOZ_ASSERT(aBaseURI);
|
MOZ_ASSERT(aBaseURI);
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
|
||||||
|
|
|
@ -2848,8 +2848,6 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
|
||||||
|
|
||||||
if (aLoadInfo.mWindow) {
|
if (aLoadInfo.mWindow) {
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
MOZ_ASSERT(aLoadInfo.mWindow->IsInnerWindow(),
|
|
||||||
"Should have inner window here!");
|
|
||||||
BindToOwner(aLoadInfo.mWindow);
|
BindToOwner(aLoadInfo.mWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,6 @@ public:
|
||||||
MOZ_ASSERT(aPrincipal);
|
MOZ_ASSERT(aPrincipal);
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobalObject);
|
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobalObject);
|
||||||
if (win) {
|
if (win) {
|
||||||
MOZ_ASSERT(win->IsInnerWindow());
|
|
||||||
if (win->GetExtantDoc()) {
|
if (win->GetExtantDoc()) {
|
||||||
mStyleBackend = win->GetExtantDoc()->GetStyleBackendType();
|
mStyleBackend = win->GetExtantDoc()->GetStyleBackendType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1465,13 +1465,10 @@ nsXULElement::LoadSrc()
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> opener = do_QueryInterface(slots->mFrameLoaderOrOpener);
|
nsCOMPtr<nsPIDOMWindowOuter> opener = do_QueryInterface(slots->mFrameLoaderOrOpener);
|
||||||
if (!opener) {
|
if (!opener) {
|
||||||
// If we are a primary xul-browser, we want to take the opener property!
|
// If we are a primary xul-browser, we want to take the opener property!
|
||||||
nsCOMPtr<nsIDOMChromeWindow> chromeWindow = do_QueryInterface(OwnerDoc()->GetWindow());
|
nsCOMPtr<nsPIDOMWindowOuter> window = OwnerDoc()->GetWindow();
|
||||||
if (AttrValueIs(kNameSpaceID_None, nsGkAtoms::primary,
|
if (AttrValueIs(kNameSpaceID_None, nsGkAtoms::primary,
|
||||||
nsGkAtoms::_true, eIgnoreCase) &&
|
nsGkAtoms::_true, eIgnoreCase) && window) {
|
||||||
chromeWindow) {
|
opener = window->TakeOpenerForInitialContentBrowser();
|
||||||
nsCOMPtr<mozIDOMWindowProxy> wp;
|
|
||||||
chromeWindow->TakeOpenerForInitialContentBrowser(getter_AddRefs(wp));
|
|
||||||
opener = nsPIDOMWindowOuter::From(wp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ ScaledFontBase::GetGlyphDesignMetrics(const uint16_t* aGlyphs, uint32_t aNumGlyp
|
||||||
}
|
}
|
||||||
cairo_font_options_destroy(options);
|
cairo_font_options_destroy(options);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,9 @@ ScaledFontDWrite::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *a
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ScaledFontDWrite::GetGlyphDesignMetrics(const uint16_t* aGlyphs, uint32_t aNumGlyphs, GlyphMetrics* aGlyphMetrics)
|
ScaledFontDWrite::GetGlyphDesignMetrics(const uint16_t* aGlyphs,
|
||||||
|
uint32_t aNumGlyphs,
|
||||||
|
GlyphMetrics* aGlyphMetrics)
|
||||||
{
|
{
|
||||||
DWRITE_FONT_METRICS fontMetrics;
|
DWRITE_FONT_METRICS fontMetrics;
|
||||||
mFontFace->GetMetrics(&fontMetrics);
|
mFontFace->GetMetrics(&fontMetrics);
|
||||||
|
@ -204,16 +206,20 @@ ScaledFontDWrite::GetGlyphDesignMetrics(const uint16_t* aGlyphs, uint32_t aNumGl
|
||||||
vector<DWRITE_GLYPH_METRICS> metrics(aNumGlyphs);
|
vector<DWRITE_GLYPH_METRICS> metrics(aNumGlyphs);
|
||||||
mFontFace->GetDesignGlyphMetrics(aGlyphs, aNumGlyphs, &metrics.front());
|
mFontFace->GetDesignGlyphMetrics(aGlyphs, aNumGlyphs, &metrics.front());
|
||||||
|
|
||||||
Float designUnitCorrection = 1.f / fontMetrics.designUnitsPerEm;
|
Float scaleFactor = mSize / fontMetrics.designUnitsPerEm;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < aNumGlyphs; i++) {
|
for (uint32_t i = 0; i < aNumGlyphs; i++) {
|
||||||
aGlyphMetrics[i].mXBearing = metrics[i].leftSideBearing * designUnitCorrection * mSize;
|
aGlyphMetrics[i].mXBearing = metrics[i].leftSideBearing * scaleFactor;
|
||||||
aGlyphMetrics[i].mXAdvance = metrics[i].advanceWidth * designUnitCorrection * mSize;
|
aGlyphMetrics[i].mXAdvance = metrics[i].advanceWidth * scaleFactor;
|
||||||
aGlyphMetrics[i].mYBearing = metrics[i].topSideBearing * designUnitCorrection * mSize;
|
aGlyphMetrics[i].mYBearing = (metrics[i].topSideBearing -
|
||||||
aGlyphMetrics[i].mYAdvance = metrics[i].advanceHeight * designUnitCorrection * mSize;
|
metrics[i].verticalOriginY) * scaleFactor;
|
||||||
aGlyphMetrics[i].mWidth = (metrics[i].advanceHeight - metrics[i].topSideBearing - metrics[i].bottomSideBearing) *
|
aGlyphMetrics[i].mYAdvance = metrics[i].advanceHeight * scaleFactor;
|
||||||
designUnitCorrection * mSize;
|
aGlyphMetrics[i].mWidth = (metrics[i].advanceWidth -
|
||||||
aGlyphMetrics[i].mHeight = (metrics[i].topSideBearing - metrics[i].verticalOriginY) * designUnitCorrection * mSize;
|
metrics[i].leftSideBearing -
|
||||||
|
metrics[i].rightSideBearing) * scaleFactor;
|
||||||
|
aGlyphMetrics[i].mHeight = (metrics[i].advanceHeight -
|
||||||
|
metrics[i].topSideBearing -
|
||||||
|
metrics[i].bottomSideBearing) * scaleFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3481,7 +3481,8 @@ gfxFont::SetupGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphID,
|
||||||
{
|
{
|
||||||
gfxRect svgBounds;
|
gfxRect svgBounds;
|
||||||
if (mFontEntry->TryGetSVGData(this) && mFontEntry->HasSVGGlyph(aGlyphID) &&
|
if (mFontEntry->TryGetSVGData(this) && mFontEntry->HasSVGGlyph(aGlyphID) &&
|
||||||
mFontEntry->GetSVGGlyphExtents(aDrawTarget, aGlyphID, &svgBounds)) {
|
mFontEntry->GetSVGGlyphExtents(aDrawTarget, aGlyphID,
|
||||||
|
GetAdjustedSize(), &svgBounds)) {
|
||||||
gfxFloat d2a = aExtents->GetAppUnitsPerDevUnit();
|
gfxFloat d2a = aExtents->GetAppUnitsPerDevUnit();
|
||||||
aExtents->SetTightGlyphExtents(aGlyphID,
|
aExtents->SetTightGlyphExtents(aGlyphID,
|
||||||
gfxRect(svgBounds.x * d2a,
|
gfxRect(svgBounds.x * d2a,
|
||||||
|
@ -3491,20 +3492,22 @@ gfxFont::SetupGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphID,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_glyph_t glyph;
|
RefPtr<ScaledFont> sf = GetScaledFont(aDrawTarget);
|
||||||
glyph.index = aGlyphID;
|
uint16_t glyphIndex = aGlyphID;
|
||||||
glyph.x = 0;
|
GlyphMetrics metrics;
|
||||||
glyph.y = 0;
|
if (mAntialiasOption == kAntialiasNone) {
|
||||||
cairo_text_extents_t extents;
|
sf->GetGlyphDesignMetrics(&glyphIndex, 1, &metrics);
|
||||||
cairo_glyph_extents(gfxFont::RefCairo(aDrawTarget), &glyph, 1, &extents);
|
} else {
|
||||||
|
aDrawTarget->GetGlyphRasterizationMetrics(sf, &glyphIndex, 1, &metrics);
|
||||||
|
}
|
||||||
|
|
||||||
const Metrics& fontMetrics = GetMetrics(eHorizontal);
|
const Metrics& fontMetrics = GetMetrics(eHorizontal);
|
||||||
int32_t appUnitsPerDevUnit = aExtents->GetAppUnitsPerDevUnit();
|
int32_t appUnitsPerDevUnit = aExtents->GetAppUnitsPerDevUnit();
|
||||||
if (!aNeedTight && extents.x_bearing >= 0 &&
|
if (!aNeedTight && metrics.mXBearing >= 0.0 &&
|
||||||
extents.y_bearing >= -fontMetrics.maxAscent &&
|
metrics.mYBearing >= -fontMetrics.maxAscent &&
|
||||||
extents.height + extents.y_bearing <= fontMetrics.maxDescent) {
|
metrics.mHeight + metrics.mYBearing <= fontMetrics.maxDescent) {
|
||||||
uint32_t appUnitsWidth =
|
uint32_t appUnitsWidth =
|
||||||
uint32_t(ceil((extents.x_bearing + extents.width)*appUnitsPerDevUnit));
|
uint32_t(ceil((metrics.mXBearing + metrics.mWidth)*appUnitsPerDevUnit));
|
||||||
if (appUnitsWidth < gfxGlyphExtents::INVALID_WIDTH) {
|
if (appUnitsWidth < gfxGlyphExtents::INVALID_WIDTH) {
|
||||||
aExtents->SetContainedGlyphWidthAppUnits(aGlyphID, uint16_t(appUnitsWidth));
|
aExtents->SetContainedGlyphWidthAppUnits(aGlyphID, uint16_t(appUnitsWidth));
|
||||||
return;
|
return;
|
||||||
|
@ -3517,8 +3520,8 @@ gfxFont::SetupGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphID,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gfxFloat d2a = appUnitsPerDevUnit;
|
gfxFloat d2a = appUnitsPerDevUnit;
|
||||||
gfxRect bounds(extents.x_bearing*d2a, extents.y_bearing*d2a,
|
gfxRect bounds(metrics.mXBearing * d2a, metrics.mYBearing * d2a,
|
||||||
extents.width*d2a, extents.height*d2a);
|
metrics.mWidth * d2a, metrics.mHeight * d2a);
|
||||||
aExtents->SetTightGlyphExtents(aGlyphID, bounds);
|
aExtents->SetTightGlyphExtents(aGlyphID, bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include "gfxSVGGlyphs.h"
|
#include "gfxSVGGlyphs.h"
|
||||||
#include "gfx2DGlue.h"
|
#include "gfx2DGlue.h"
|
||||||
|
|
||||||
#include "cairo.h"
|
|
||||||
|
|
||||||
#include "harfbuzz/hb.h"
|
#include "harfbuzz/hb.h"
|
||||||
#include "harfbuzz/hb-ot.h"
|
#include "harfbuzz/hb-ot.h"
|
||||||
#include "graphite2/Font.h"
|
#include "graphite2/Font.h"
|
||||||
|
@ -319,22 +317,15 @@ gfxFontEntry::HasSVGGlyph(uint32_t aGlyphId)
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxFontEntry::GetSVGGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphId,
|
gfxFontEntry::GetSVGGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphId,
|
||||||
gfxRect *aResult)
|
gfxFloat aSize, gfxRect* aResult)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mSVGInitialized,
|
MOZ_ASSERT(mSVGInitialized,
|
||||||
"SVG data has not yet been loaded. TryGetSVGData() first.");
|
"SVG data has not yet been loaded. TryGetSVGData() first.");
|
||||||
MOZ_ASSERT(mUnitsPerEm >= kMinUPEM && mUnitsPerEm <= kMaxUPEM,
|
MOZ_ASSERT(mUnitsPerEm >= kMinUPEM && mUnitsPerEm <= kMaxUPEM,
|
||||||
"font has invalid unitsPerEm");
|
"font has invalid unitsPerEm");
|
||||||
|
|
||||||
cairo_matrix_t fontMatrix;
|
gfxMatrix svgToApp(aSize / mUnitsPerEm, 0, 0, aSize / mUnitsPerEm, 0, 0);
|
||||||
cairo_get_font_matrix(gfxFont::RefCairo(aDrawTarget), &fontMatrix);
|
return mSVGGlyphs->GetGlyphExtents(aGlyphId, svgToApp, aResult);
|
||||||
|
|
||||||
gfxMatrix svgToAppSpace(fontMatrix.xx, fontMatrix.yx,
|
|
||||||
fontMatrix.xy, fontMatrix.yy,
|
|
||||||
fontMatrix.x0, fontMatrix.y0);
|
|
||||||
svgToAppSpace.PreScale(1.0f / mUnitsPerEm, 1.0f / mUnitsPerEm);
|
|
||||||
|
|
||||||
return mSVGGlyphs->GetGlyphExtents(aGlyphId, svgToAppSpace, aResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -205,7 +205,7 @@ public:
|
||||||
bool TryGetSVGData(gfxFont* aFont);
|
bool TryGetSVGData(gfxFont* aFont);
|
||||||
bool HasSVGGlyph(uint32_t aGlyphId);
|
bool HasSVGGlyph(uint32_t aGlyphId);
|
||||||
bool GetSVGGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphId,
|
bool GetSVGGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphId,
|
||||||
gfxRect *aResult);
|
gfxFloat aSize, gfxRect* aResult);
|
||||||
void RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
void RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
||||||
mozilla::SVGContextPaint* aContextPaint);
|
mozilla::SVGContextPaint* aContextPaint);
|
||||||
// Call this when glyph geometry or rendering has changed
|
// Call this when glyph geometry or rendering has changed
|
||||||
|
|
|
@ -191,28 +191,11 @@ gfxGDIFont::Initialize()
|
||||||
|
|
||||||
LOGFONTW logFont;
|
LOGFONTW logFont;
|
||||||
|
|
||||||
// Figure out if we want to do synthetic oblique styling.
|
|
||||||
GDIFontEntry* fe = static_cast<GDIFontEntry*>(GetFontEntry());
|
|
||||||
bool wantFakeItalic = mStyle.style != NS_FONT_STYLE_NORMAL &&
|
|
||||||
fe->IsUpright() && mStyle.allowSyntheticStyle;
|
|
||||||
|
|
||||||
// If the font's family has an actual italic face (but font matching
|
|
||||||
// didn't choose it), we have to use a cairo transform instead of asking
|
|
||||||
// GDI to italicize, because that would use a different face and result
|
|
||||||
// in a possible glyph ID mismatch between shaping and rendering.
|
|
||||||
//
|
|
||||||
// We use the mFamilyHasItalicFace flag in the entry in case of user fonts,
|
|
||||||
// where the *CSS* family may not know about italic faces that are present
|
|
||||||
// in the *GDI* family, and which GDI would use if we asked it to perform
|
|
||||||
// the "italicization".
|
|
||||||
bool useCairoFakeItalic = wantFakeItalic && fe->mFamilyHasItalicFace;
|
|
||||||
|
|
||||||
if (mAdjustedSize == 0.0) {
|
if (mAdjustedSize == 0.0) {
|
||||||
mAdjustedSize = mStyle.size;
|
mAdjustedSize = mStyle.size;
|
||||||
if (mStyle.sizeAdjust > 0.0 && mAdjustedSize > 0.0) {
|
if (mStyle.sizeAdjust > 0.0 && mAdjustedSize > 0.0) {
|
||||||
// to implement font-size-adjust, we first create the "unadjusted" font
|
// to implement font-size-adjust, we first create the "unadjusted" font
|
||||||
FillLogFont(logFont, mAdjustedSize,
|
FillLogFont(logFont, mAdjustedSize);
|
||||||
wantFakeItalic && !useCairoFakeItalic);
|
|
||||||
mFont = ::CreateFontIndirectW(&logFont);
|
mFont = ::CreateFontIndirectW(&logFont);
|
||||||
|
|
||||||
// initialize its metrics so we can calculate size adjustment
|
// initialize its metrics so we can calculate size adjustment
|
||||||
|
@ -245,7 +228,7 @@ gfxGDIFont::Initialize()
|
||||||
|
|
||||||
// this may end up being zero
|
// this may end up being zero
|
||||||
mAdjustedSize = ROUND(mAdjustedSize);
|
mAdjustedSize = ROUND(mAdjustedSize);
|
||||||
FillLogFont(logFont, mAdjustedSize, wantFakeItalic && !useCairoFakeItalic);
|
FillLogFont(logFont, mAdjustedSize);
|
||||||
mFont = ::CreateFontIndirectW(&logFont);
|
mFont = ::CreateFontIndirectW(&logFont);
|
||||||
|
|
||||||
mMetrics = new gfxFont::Metrics;
|
mMetrics = new gfxFont::Metrics;
|
||||||
|
@ -458,8 +441,7 @@ gfxGDIFont::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfxGDIFont::FillLogFont(LOGFONTW& aLogFont, gfxFloat aSize,
|
gfxGDIFont::FillLogFont(LOGFONTW& aLogFont, gfxFloat aSize)
|
||||||
bool aUseGDIFakeItalic)
|
|
||||||
{
|
{
|
||||||
GDIFontEntry *fe = static_cast<GDIFontEntry*>(GetFontEntry());
|
GDIFontEntry *fe = static_cast<GDIFontEntry*>(GetFontEntry());
|
||||||
|
|
||||||
|
@ -480,11 +462,6 @@ gfxGDIFont::FillLogFont(LOGFONTW& aLogFont, gfxFloat aSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
fe->FillLogFont(&aLogFont, weight, aSize);
|
fe->FillLogFont(&aLogFont, weight, aSize);
|
||||||
|
|
||||||
// If GDI synthetic italic is wanted, force the lfItalic field to true
|
|
||||||
if (aUseGDIFakeItalic) {
|
|
||||||
aLogFont.lfItalic = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче