mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Merge mozilla-central to mozilla-inbound
This commit is contained in:
commit
3a762886de
@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"no-undef": "off"
|
||||
}
|
||||
};
|
@ -191,12 +191,12 @@ var gGestureSupport = {
|
||||
|
||||
let isVerticalSwipe = false;
|
||||
if (aEvent.direction == aEvent.DIRECTION_UP) {
|
||||
if (gMultiProcessBrowser || content.pageYOffset > 0) {
|
||||
if (gMultiProcessBrowser || window.content.pageYOffset > 0) {
|
||||
return false;
|
||||
}
|
||||
isVerticalSwipe = true;
|
||||
} else if (aEvent.direction == aEvent.DIRECTION_DOWN) {
|
||||
if (gMultiProcessBrowser || content.pageYOffset < content.scrollMaxY) {
|
||||
if (gMultiProcessBrowser || window.content.pageYOffset < window.content.scrollMaxY) {
|
||||
return false;
|
||||
}
|
||||
isVerticalSwipe = true;
|
||||
@ -442,10 +442,10 @@ var gGestureSupport = {
|
||||
* The MozRotateGestureUpdate event triggering this call
|
||||
*/
|
||||
rotate(aEvent) {
|
||||
if (!(content.document instanceof ImageDocument))
|
||||
if (!(window.content.document instanceof ImageDocument))
|
||||
return;
|
||||
|
||||
let contentElement = content.document.body.firstElementChild;
|
||||
let contentElement = window.content.document.body.firstElementChild;
|
||||
if (!contentElement)
|
||||
return;
|
||||
// If we're currently snapping, cancel that snap
|
||||
@ -461,10 +461,10 @@ var gGestureSupport = {
|
||||
* Perform a rotation end for ImageDocuments
|
||||
*/
|
||||
rotateEnd() {
|
||||
if (!(content.document instanceof ImageDocument))
|
||||
if (!(window.content.document instanceof ImageDocument))
|
||||
return;
|
||||
|
||||
let contentElement = content.document.body.firstElementChild;
|
||||
let contentElement = window.content.document.body.firstElementChild;
|
||||
if (!contentElement)
|
||||
return;
|
||||
|
||||
@ -533,12 +533,12 @@ var gGestureSupport = {
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
if (!(content.document instanceof ImageDocument))
|
||||
if (!(window.content.document instanceof ImageDocument))
|
||||
return;
|
||||
|
||||
let contentElement = content.document.body.firstElementChild;
|
||||
let transformValue = content.window.getComputedStyle(contentElement)
|
||||
.transform;
|
||||
let contentElement = window.content.document.body.firstElementChild;
|
||||
let transformValue = window.content.window.getComputedStyle(contentElement)
|
||||
.transform;
|
||||
|
||||
if (transformValue == "none") {
|
||||
this.rotation = 0;
|
||||
@ -558,10 +558,10 @@ var gGestureSupport = {
|
||||
* Removes the transition rule by removing the completeRotation class
|
||||
*/
|
||||
_clearCompleteRotation() {
|
||||
let contentElement = content.document &&
|
||||
content.document instanceof ImageDocument &&
|
||||
content.document.body &&
|
||||
content.document.body.firstElementChild;
|
||||
let contentElement = window.content.document &&
|
||||
window.content.document instanceof ImageDocument &&
|
||||
window.content.document.body &&
|
||||
window.content.document.body.firstElementChild;
|
||||
if (!contentElement)
|
||||
return;
|
||||
contentElement.classList.remove("completeRotation");
|
||||
|
@ -3,7 +3,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* eslint-env mozilla/browser-window */
|
||||
/* eslint no-undef: "error" */
|
||||
/* global OpenGraphBuilder:false, DynamicResizeWatcher:false */
|
||||
|
||||
// the "exported" symbols
|
||||
|
@ -4737,10 +4737,10 @@ var XULBrowserWindow = {
|
||||
// Don't need to re-enable/disable find commands for same-document location changes
|
||||
// (e.g. the replaceStates in about:addons)
|
||||
if (!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
|
||||
if (content.document.readyState == "interactive" || content.document.readyState == "complete")
|
||||
disableFindCommands(shouldDisableFind(content.document));
|
||||
if (window.content.document.readyState == "interactive" || window.content.document.readyState == "complete")
|
||||
disableFindCommands(shouldDisableFind(window.content.document));
|
||||
else {
|
||||
content.document.addEventListener("readystatechange", onContentRSChange);
|
||||
window.content.document.addEventListener("readystatechange", onContentRSChange);
|
||||
}
|
||||
}
|
||||
} else
|
||||
@ -5220,7 +5220,7 @@ nsBrowserAccess.prototype = {
|
||||
newWindow = browser.contentWindow;
|
||||
break;
|
||||
default : // OPEN_CURRENTWINDOW or an illegal value
|
||||
newWindow = content;
|
||||
newWindow = window.content;
|
||||
if (aURI) {
|
||||
let loadflags = isExternal ?
|
||||
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
|
||||
|
@ -1945,7 +1945,7 @@
|
||||
|
||||
if (aParams.opener) {
|
||||
if (aParams.remoteType) {
|
||||
throw new Exception("Cannot set opener window on a remote browser!");
|
||||
throw new Error("Cannot set opener window on a remote browser!");
|
||||
}
|
||||
b.QueryInterface(Ci.nsIFrameLoaderOwner).presetOpenerWindow(aParams.opener);
|
||||
}
|
||||
@ -5475,7 +5475,7 @@
|
||||
</handler>
|
||||
<handler event="DOMAudioPlaybackStarted">
|
||||
<![CDATA[
|
||||
var tab = getTabFromAudioEvent(event)
|
||||
var tab = this.getTabFromAudioEvent(event)
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
@ -5505,7 +5505,7 @@
|
||||
</handler>
|
||||
<handler event="DOMAudioPlaybackStopped">
|
||||
<![CDATA[
|
||||
var tab = getTabFromAudioEvent(event)
|
||||
var tab = this.getTabFromAudioEvent(event)
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
@ -5527,7 +5527,7 @@
|
||||
</handler>
|
||||
<handler event="DOMAudioPlaybackBlockStarted">
|
||||
<![CDATA[
|
||||
var tab = getTabFromAudioEvent(event)
|
||||
var tab = this.getTabFromAudioEvent(event)
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
@ -5541,7 +5541,7 @@
|
||||
</handler>
|
||||
<handler event="DOMAudioPlaybackBlockStopped">
|
||||
<![CDATA[
|
||||
var tab = getTabFromAudioEvent(event)
|
||||
var tab = this.getTabFromAudioEvent(event)
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
function hideSelectPopup(selectPopup, mode = "enter", win = window) {
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
let selectClosedPromise = ContentTask.spawn(browser, null, function*() {
|
||||
|
@ -6,6 +6,8 @@ add_task(function* () {
|
||||
let rooturi = "https://example.com/browser/toolkit/modules/tests/browser/";
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, rooturi + "metadata_simple.html");
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { rooturi }, function* (args) {
|
||||
Components.utils.import("resource://gre/modules/PageMetadata.jsm");
|
||||
|
||||
let result = PageMetadata.getData(content.document);
|
||||
// Result should have description.
|
||||
Assert.equal(result.url, args.rooturi + "metadata_simple.html", "metadata url is correct");
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
// This is testing the aboutCertError page (Bug 1207107).
|
||||
|
@ -2,8 +2,6 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
add_task(function* () {
|
||||
let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
|
||||
@ -28,8 +26,8 @@ add_task(function* () {
|
||||
var xPixel = 0; // Use the first pixel of the screen since it is maximized.
|
||||
|
||||
let resultLocation = yield new Promise(resolve => {
|
||||
messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
|
||||
messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
|
||||
window.messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
|
||||
window.messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
|
||||
resolve(message.data.location);
|
||||
});
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
function test() {
|
||||
var tabCount = gBrowser.tabs.length;
|
||||
gBrowser.selectedBrowser.focus();
|
||||
browserDOMWindow.openURI(makeURI("about:blank"),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
window.browserDOMWindow.openURI(makeURI("about:blank"),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
is(gBrowser.tabs.length, tabCount + 1,
|
||||
"'--new-tab about:blank' opens a new tab");
|
||||
is(gBrowser.selectedTab, gBrowser.tabs[tabCount],
|
||||
|
@ -1,8 +1,7 @@
|
||||
add_task(function *() {
|
||||
let browserLoadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
browserDOMWindow.openURI(makeURI("about:"), null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW, null)
|
||||
window.browserDOMWindow.openURI(makeURI("about:"), null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW, null)
|
||||
yield browserLoadedPromise;
|
||||
is(gBrowser.currentURI.spec, "about:", "page loads in the current content window");
|
||||
});
|
||||
|
||||
|
@ -653,7 +653,7 @@ function test_localFile() {
|
||||
function test_tabClose() {
|
||||
return Task.spawn(function* () {
|
||||
if (!Preferences.get("xpinstall.customConfirmationUI", false)) {
|
||||
runNextTest();
|
||||
info("Test skipped due to xpinstall.customConfirmationUI being false.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,6 @@
|
||||
* non-browser cases.
|
||||
*/
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
var testPage1 = "data:text/html,<html id='html1'><body id='body1'><button id='button1'>Tab 1</button></body></html>";
|
||||
var testPage2 = "data:text/html,<html id='html2'><body id='body2'><button id='button2'>Tab 2</button></body></html>";
|
||||
var testPage3 = "data:text/html,<html id='html3'><body id='body3' contenteditable='true'><button id='button3'>Tab 3</button></body></html>";
|
||||
@ -28,7 +26,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
|
||||
}
|
||||
|
||||
if (onContent) {
|
||||
messageManager.addMessageListener("BrowserTest:FocusChanged", focusChangedListener);
|
||||
window.messageManager.addMessageListener("BrowserTest:FocusChanged", focusChangedListener);
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { expectedElementId: expectedElement }, function* (arg) {
|
||||
let contentExpectedElement = content.document.getElementById(arg.expectedElementId);
|
||||
@ -79,7 +77,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
|
||||
is(fm.focusedElement, expectedElement, desc + " element matches");
|
||||
|
||||
if (onContent) {
|
||||
messageManager.removeMessageListener("BrowserTest:FocusChanged", focusChangedListener);
|
||||
window.messageManager.removeMessageListener("BrowserTest:FocusChanged", focusChangedListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
// Test offline quota warnings - must be run as a mochitest-browser test or
|
||||
// else the test runner gets in the way of notifications due to bug 857897.
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
function swapTabsAndCloseOther(a, b) {
|
||||
gBrowser.swapBrowsersAndCloseOther(gBrowser.tabs[b], gBrowser.tabs[a]);
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ var currentPromiseResolver = null;
|
||||
function* getFocusedElementForBrowser(browser, dontCheckExtraFocus = false) {
|
||||
if (gMultiProcessBrowser) {
|
||||
return new Promise((resolve, reject) => {
|
||||
messageManager.addMessageListener("Browser:GetCurrentFocus", function getCurrentFocus(message) {
|
||||
messageManager.removeMessageListener("Browser:GetCurrentFocus", getCurrentFocus);
|
||||
window.messageManager.addMessageListener("Browser:GetCurrentFocus", function getCurrentFocus(message) {
|
||||
window.messageManager.removeMessageListener("Browser:GetCurrentFocus", getCurrentFocus);
|
||||
resolve(message.data.details);
|
||||
});
|
||||
|
||||
@ -144,7 +144,7 @@ add_task(function*() {
|
||||
yield SimpleTest.promiseFocus();
|
||||
|
||||
if (gMultiProcessBrowser) {
|
||||
messageManager.addMessageListener("Browser:FocusChanged", message => {
|
||||
window.messageManager.addMessageListener("Browser:FocusChanged", message => {
|
||||
actualEvents.push(message.data.details);
|
||||
compareFocusResults();
|
||||
});
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
add_task(function* () {
|
||||
yield setLinks("0,1,2,3,4,5,6,7,8");
|
||||
setPinnedLinks("");
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
add_task(function* () {
|
||||
// set max rows to 1, to avoid scroll events by clicking middle button
|
||||
yield pushPrefs(["browser.newtabpage.rows", 1]);
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
add_task(function* () {
|
||||
// set max rows to 1, to avoid scroll events by clicking middle button
|
||||
yield pushPrefs(["browser.newtabpage.rows", 1]);
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
// See browser/components/search/test/browser_*_behavior.js for tests of actual
|
||||
// searches.
|
||||
|
||||
|
@ -68,6 +68,9 @@ function promiseTabLoadEvent(tab, url) {
|
||||
|
||||
const PREF_SECURITY_DELAY_INITIAL = Services.prefs.getIntPref("security.notification_enable_delay");
|
||||
|
||||
// Tests that call setup() should have a `tests` array defined for the actual
|
||||
// tests to be run.
|
||||
/* global tests */
|
||||
function setup() {
|
||||
BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/")
|
||||
.then(goNext);
|
||||
|
@ -41,7 +41,7 @@ function test() {
|
||||
return "FAIL.";
|
||||
};
|
||||
}.toString() + ")();";
|
||||
let mm = getGroupMessageManager("social");
|
||||
let mm = window.getGroupMessageManager("social");
|
||||
mm.loadFrameScript(frameScript, true);
|
||||
|
||||
// Animation on the panel can cause intermittent failures such as bug 1115131.
|
||||
@ -191,7 +191,7 @@ var tests = {
|
||||
// ensure correct state
|
||||
SocialUI.onCustomizeEnd(window);
|
||||
|
||||
let mm = getGroupMessageManager("social");
|
||||
let mm = window.getGroupMessageManager("social");
|
||||
mm.addMessageListener("sharedata", function handler(msg) {
|
||||
BrowserTestUtils.removeTab(testTab).then(() => {
|
||||
hasoptions(testData.options, JSON.parse(msg.data));
|
||||
@ -277,7 +277,7 @@ var tests = {
|
||||
}
|
||||
});
|
||||
|
||||
let mm = getGroupMessageManager("social");
|
||||
let mm = window.getGroupMessageManager("social");
|
||||
mm.addMessageListener("sharedata", function handler(msg) {
|
||||
is(msg.data, expecting, "microformats data ok");
|
||||
BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },
|
||||
@ -325,7 +325,7 @@ var tests = {
|
||||
ensureFrameLoaded(subframe, activationPage).then(() => {
|
||||
is(subframe.contentDocument.location.href, activationPage, "activation page loaded");
|
||||
promiseObserverNotified("social:provider-enabled").then(() => {
|
||||
let mm = getGroupMessageManager("social");
|
||||
let mm = window.getGroupMessageManager("social");
|
||||
mm.addMessageListener("sharedata", function handler(msg) {
|
||||
ok(true, "share completed");
|
||||
|
||||
|
@ -117,11 +117,6 @@ function runSocialTestWithProvider(manifest, callback, finishcallback) {
|
||||
providersAdded++;
|
||||
info("runSocialTestWithProvider: provider added");
|
||||
|
||||
// we want to set the first specified provider as the UI's provider
|
||||
if (provider.origin == manifests[0].origin) {
|
||||
firstProvider = provider;
|
||||
}
|
||||
|
||||
// If we've added all the providers we need, call the callback to start
|
||||
// the tests (and give it a callback it can call to finish them)
|
||||
if (providersAdded == manifests.length) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function test() {
|
||||
const URI = "data:text/plain,bug562649";
|
||||
browserDOMWindow.openURI(makeURI(URI),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
window.browserDOMWindow.openURI(makeURI(URI),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
|
||||
is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI");
|
||||
is(gURLBar.value, URI, "location bar value matches test URI");
|
||||
|
@ -1,3 +1,6 @@
|
||||
// urlbar is injected into the urlbar add-on iframe by Panel.jsm for tests.
|
||||
/* global urlbar */
|
||||
|
||||
// Listen for messages from the test.
|
||||
addEventListener("TestEvent", event => {
|
||||
let type = event.detail.type;
|
||||
|
@ -1240,8 +1240,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
UpdatePopupNotificationsVisibility();
|
||||
}
|
||||
}
|
||||
if (ExtensionSearchHandler.hasActiveInputSession()) {
|
||||
ExtensionSearchHandler.handleInputCancelled();
|
||||
if (this.ExtensionSearchHandler.hasActiveInputSession()) {
|
||||
this.ExtensionSearchHandler.handleInputCancelled();
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
|
@ -3,6 +3,9 @@
|
||||
* 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/. */
|
||||
|
||||
// Via web-panels.xul
|
||||
/* import-globals-from browser.js */
|
||||
|
||||
const NS_ERROR_MODULE_NETWORK = 2152398848;
|
||||
const NS_NET_STATUS_READ_FROM = NS_ERROR_MODULE_NETWORK + 8;
|
||||
const NS_NET_STATUS_WROTE_TO = NS_ERROR_MODULE_NETWORK + 9;
|
||||
|
@ -3,6 +3,9 @@
|
||||
* 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/. */
|
||||
|
||||
// Via webext-panels.xul
|
||||
/* import-globals-from browser.js */
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionParent",
|
||||
"resource://gre/modules/ExtensionParent.jsm");
|
||||
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
|
||||
|
@ -3,9 +3,5 @@
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/browser-test"
|
||||
],
|
||||
|
||||
"rules": {
|
||||
"no-undef": "error"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = { // eslint-disable-line no-undef
|
||||
module.exports = {
|
||||
"env": {
|
||||
"mozilla/browser-window": true,
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = { // eslint-disable-line no-undef
|
||||
module.exports = {
|
||||
"extends": "../../../toolkit/components/extensions/.eslintrc.js",
|
||||
|
||||
"globals": {
|
||||
|
@ -147,11 +147,7 @@ add_task(function* testExecuteScript() {
|
||||
}).then(result => {
|
||||
browser.test.fail("Expected error when specifying invalid frame ID");
|
||||
}, error => {
|
||||
let details = {
|
||||
frame_id: Number.MAX_SAFE_INTEGER,
|
||||
matchesHost: ["http://mochi.test/", "http://example.com/"],
|
||||
};
|
||||
browser.test.assertEq(`No window matching ${JSON.stringify(details)}`,
|
||||
browser.test.assertEq(`Frame not found, or missing host permission`,
|
||||
error.message, "Got expected error");
|
||||
}),
|
||||
|
||||
@ -161,10 +157,7 @@ add_task(function* testExecuteScript() {
|
||||
}).then(result => {
|
||||
browser.test.fail("Expected error when trying to execute on invalid domain");
|
||||
}, error => {
|
||||
let details = {
|
||||
matchesHost: ["http://mochi.test/", "http://example.com/"],
|
||||
};
|
||||
browser.test.assertEq(`No window matching ${JSON.stringify(details)}`,
|
||||
browser.test.assertEq("Missing host permission for the tab",
|
||||
error.message, "Got expected error");
|
||||
});
|
||||
|
||||
|
@ -179,7 +179,7 @@ add_task(function* testMatchDataURI() {
|
||||
code: "location.href;",
|
||||
allFrames: true,
|
||||
}),
|
||||
/No window matching/,
|
||||
/Missing host permission/,
|
||||
"Should not execute in `data:` frame");
|
||||
|
||||
browser.test.sendMessage("done");
|
||||
|
@ -245,6 +245,7 @@ async function openContextMenuInFrame(frameId) {
|
||||
async function openContextMenu(selector = "#img1") {
|
||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "mousedown", button: 2}, gBrowser.selectedBrowser);
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, gBrowser.selectedBrowser);
|
||||
await popupShownPromise;
|
||||
return contentAreaContextMenu;
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = { // eslint-disable-line no-undef
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"../../.eslintrc.js"
|
||||
],
|
||||
|
@ -2,8 +2,6 @@
|
||||
* 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/. */
|
||||
|
||||
/* eslint no-undef:2 */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
@ -1,6 +1,3 @@
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
const BASE_URL = "http://mochi.test:8888/browser/browser/components/originattributes/test/browser/";
|
||||
const BASE_DOMAIN = "mochi.test";
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
/**
|
||||
* Given some window in the parent process, ensure that
|
||||
* the nsIXULWindow has the CHROME_PRIVATE_WINDOW chromeFlag,
|
||||
|
@ -35,7 +35,6 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
function promiseSHistoryCount(browser) {
|
||||
/* eslint-env mozilla/frame-script */
|
||||
return ContentTask.spawn(browser, null, function* () {
|
||||
return docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory.count;
|
||||
});
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-env mozilla/frame-script */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
|
@ -33,7 +33,6 @@ function restoreClosedTabWithValue(rval) {
|
||||
}
|
||||
|
||||
function promiseNewLocationAndHistoryEntryReplaced(browser, snippet) {
|
||||
/* eslint-env mozilla/frame-script */
|
||||
return ContentTask.spawn(browser, snippet, function* (codeSnippet) {
|
||||
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
let shistory = webNavigation.sessionHistory;
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
// This file generates content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
const PAGE = "http://example.com/";
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-env mozilla/frame-script */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
|
@ -26,7 +26,6 @@ add_task(function*() {
|
||||
is(entries[0].url, PAGE_2, "Should have PAGE_2 as the sole history entry");
|
||||
is(browser.currentURI.spec, PAGE_2, "Should have PAGE_2 as the browser currentURI");
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
yield ContentTask.spawn(browser, PAGE_2, function*(expectedURL) {
|
||||
docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
Assert.equal(docShell.currentURI.spec, expectedURL,
|
||||
|
@ -1,6 +1,3 @@
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,3 @@
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
const STATE = {
|
||||
|
@ -1,9 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
const HISTOGRAM_NAME = "FX_SESSION_RESTORE_SEND_UPDATE_CAUSED_OOM";
|
||||
|
@ -2,9 +2,6 @@
|
||||
* 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/. */
|
||||
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
|
@ -1,6 +1,3 @@
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
const URL = "http://example.com/browser_switch_remoteness_";
|
||||
|
@ -1,6 +1,3 @@
|
||||
// This file spawns content tasks.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
requestLongerTimeout(2);
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
// This file spawns a content task.
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
// This file expects these globals to be defined by the test case.
|
||||
/* global gTestTab:true, gContentAPI:true, gContentWindow:true, tests:false */
|
||||
|
||||
|
@ -38,7 +38,6 @@ MOZ_ENABLE_SIGNMAR=1
|
||||
|
||||
MOZ_APP_VERSION=$FIREFOX_VERSION
|
||||
MOZ_APP_VERSION_DISPLAY=$FIREFOX_VERSION_DISPLAY
|
||||
MOZ_EXTENSIONS_DEFAULT=" gio"
|
||||
# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
|
||||
# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
|
||||
# specified. It should never point to the "official" branding directory.
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = { // eslint-disable-line no-undef
|
||||
module.exports = {
|
||||
"extends": "../../.eslintrc.js",
|
||||
|
||||
"globals": {
|
||||
|
@ -7,7 +7,6 @@ const CONTENT_SEARCH_MSG = "ContentSearch";
|
||||
const TEST_CONTENT_SCRIPT_BASENAME = "contentSearch.js";
|
||||
|
||||
var gMsgMan;
|
||||
/* eslint no-undef:"error" */
|
||||
/* import-globals-from ../../../components/search/test/head.js */
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/browser/components/search/test/head.js",
|
||||
|
@ -179,8 +179,6 @@ def old_configure_options(*options):
|
||||
'--enable-gamepad',
|
||||
'--enable-gconf',
|
||||
'--enable-gczeal',
|
||||
'--enable-gio',
|
||||
'--enable-gnomeui',
|
||||
'--enable-gold',
|
||||
'--enable-hardware-aec-ns',
|
||||
'--enable-icf',
|
||||
|
@ -921,7 +921,20 @@ endif
|
||||
rustflags_override = RUSTFLAGS='$(rustflags)'
|
||||
endif
|
||||
|
||||
CARGO_BUILD = env $(rustflags_override) \
|
||||
ifdef MOZ_MSVCBITS
|
||||
# If we are building a MozillaBuild shell, we want to clear out the
|
||||
# vcvars.bat environment variables for cargo builds. This is because
|
||||
# a 32-bit MozillaBuild shell on a 64-bit machine will try to use
|
||||
# the 32-bit compiler/linker for everything, while cargo/rustc wants
|
||||
# to use the 64-bit linker for build.rs scripts. This conflict results
|
||||
# in a build failure (see bug 1350001). Clearing out *just* the changes
|
||||
# from vcvars.bat is hard, so we just clear out the whole environment.
|
||||
environment_cleaner = -i
|
||||
else
|
||||
environment_cleaner =
|
||||
endif
|
||||
|
||||
CARGO_BUILD = env $(environment_cleaner) $(rustflags_override) \
|
||||
CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
|
||||
RUSTC=$(RUSTC) \
|
||||
MOZ_DIST=$(ABS_DIST) \
|
||||
|
@ -1271,9 +1271,7 @@ hunspell.hxx
|
||||
#if MOZ_SYSTEM_BZ2==1
|
||||
bzlib.h
|
||||
#endif
|
||||
#ifdef MOZ_ENABLE_GIO
|
||||
gio/gio.h
|
||||
#endif
|
||||
#if MOZ_SYSTEM_LIBEVENT==1
|
||||
event.h
|
||||
#else
|
||||
|
@ -1019,10 +1019,9 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
||||
NS_ConvertUTF16toUTF8 value(aStringValue);
|
||||
|
||||
// FIXME this is using the wrong base uri (bug 1343919)
|
||||
RefPtr<css::URLExtraData> data =
|
||||
new css::URLExtraData(aDocument->GetDocumentURI(),
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->NodePrincipal());
|
||||
RefPtr<URLExtraData> data = new URLExtraData(aDocument->GetDocumentURI(),
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->NodePrincipal());
|
||||
|
||||
RefPtr<RawServoDeclarationBlock> servoDeclarationBlock =
|
||||
Servo_ParseProperty(&name, &value, data).Consume();
|
||||
|
@ -117,10 +117,9 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
||||
if (aDocument->IsStyledByServo()) {
|
||||
nsTimingFunction timingFunction;
|
||||
// FIXME this is using the wrong base uri (bug 1343919)
|
||||
RefPtr<css::URLExtraData> data =
|
||||
new css::URLExtraData(aDocument->GetDocumentURI(),
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->NodePrincipal());
|
||||
RefPtr<URLExtraData> data = new URLExtraData(aDocument->GetDocumentURI(),
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->NodePrincipal());
|
||||
if (!Servo_ParseEasing(&aEasing, data, &timingFunction)) {
|
||||
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
|
||||
return Nothing();
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/URLExtraData.h"
|
||||
#include "mozilla/dom/Attr.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsIAtom.h"
|
||||
@ -348,7 +349,7 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
||||
MOZ_ASSERT(bindingParent);
|
||||
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
|
||||
// XXX Ignore xml:base as we are removing it.
|
||||
return do_AddRef(useElement->GetContentBaseURI());
|
||||
return do_AddRef(useElement->GetContentURLData()->BaseURI());
|
||||
}
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
@ -418,7 +419,7 @@ nsIContent::GetBaseURIWithoutXMLBase() const
|
||||
nsIContent* bindingParent = GetBindingParent();
|
||||
MOZ_ASSERT(bindingParent);
|
||||
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
|
||||
return useElement->GetContentBaseURI();
|
||||
return useElement->GetContentURLData()->BaseURI();
|
||||
}
|
||||
// This also ignores the case that SVG inside XBL binding.
|
||||
// But it is probably fine.
|
||||
@ -445,6 +446,23 @@ nsIContent::GetBaseURIForStyleAttr() const
|
||||
? do_AddRef(baseWithoutXMLBase) : base.forget();
|
||||
}
|
||||
|
||||
URLExtraData*
|
||||
nsIContent::GetURLDataForStyleAttr() const
|
||||
{
|
||||
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
|
||||
nsIContent* bindingParent = GetBindingParent();
|
||||
MOZ_ASSERT(bindingParent);
|
||||
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
|
||||
return useElement->GetContentURLData();
|
||||
}
|
||||
// We are not going to support xml:base for stylo, but we want to
|
||||
// ensure we unship that support before we enabling stylo.
|
||||
MOZ_ASSERT(nsLayoutUtils::StyleAttrWithXMLBaseDisabled());
|
||||
// This also ignores the case that SVG inside XBL binding.
|
||||
// But it is probably fine.
|
||||
return OwnerDoc()->DefaultStyleAttrURLData();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static inline JSObject*
|
||||
|
@ -1725,8 +1725,8 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
|
||||
|
||||
RefPtr<DeclarationBlock> decl;
|
||||
if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) {
|
||||
RefPtr<css::URLExtraData> data =
|
||||
new css::URLExtraData(baseURI, docURI, aElement->NodePrincipal());
|
||||
RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
|
||||
aElement->NodePrincipal());
|
||||
decl = ServoDeclarationBlock::FromCssText(aString, data);
|
||||
} else {
|
||||
css::Loader* cssLoader = ownerDoc->CSSLoader();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/URLExtraData.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/Logging.h"
|
||||
@ -3583,6 +3584,27 @@ nsDocument::SetBaseURI(nsIURI* aURI)
|
||||
RefreshLinkHrefs();
|
||||
}
|
||||
|
||||
URLExtraData*
|
||||
nsIDocument::DefaultStyleAttrURLData()
|
||||
{
|
||||
#ifdef MOZ_STYLO
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsIURI* baseURI = GetDocBaseURI();
|
||||
nsIURI* docURI = GetDocumentURI();
|
||||
nsIPrincipal* principal = NodePrincipal();
|
||||
if (!mCachedURLData ||
|
||||
mCachedURLData->BaseURI() != baseURI ||
|
||||
mCachedURLData->GetReferrer() != docURI ||
|
||||
mCachedURLData->GetPrincipal() != principal) {
|
||||
mCachedURLData = new URLExtraData(baseURI, docURI, principal);
|
||||
}
|
||||
return mCachedURLData;
|
||||
#else
|
||||
MOZ_CRASH("Should not be called for non-stylo build");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::GetBaseTarget(nsAString &aBaseTarget)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ class nsXBLBinding;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
struct URLExtraData;
|
||||
namespace dom {
|
||||
class ShadowRoot;
|
||||
} // namespace dom
|
||||
@ -961,6 +962,9 @@ public:
|
||||
// Returns base URI for style attribute.
|
||||
already_AddRefed<nsIURI> GetBaseURIForStyleAttr() const;
|
||||
|
||||
// Returns the URL data for style attribute.
|
||||
mozilla::URLExtraData* GetURLDataForStyleAttr() const;
|
||||
|
||||
virtual nsresult GetEventTargetParent(
|
||||
mozilla::EventChainPreVisitor& aVisitor) override;
|
||||
|
||||
|
@ -110,6 +110,7 @@ class EventStates;
|
||||
class PendingAnimationTracker;
|
||||
class StyleSetHandle;
|
||||
template<typename> class OwningNonNull;
|
||||
struct URLExtraData;
|
||||
|
||||
namespace css {
|
||||
class Loader;
|
||||
@ -484,6 +485,15 @@ public:
|
||||
|
||||
virtual void SetBaseURI(nsIURI* aURI) = 0;
|
||||
|
||||
/**
|
||||
* Return the URL data which style system needs for resolving url value.
|
||||
* This method attempts to use the cached object in mCachedURLData, but
|
||||
* if the base URI, document URI, or principal has changed since last
|
||||
* call to this function, or the function is called the first time for
|
||||
* the document, a new one is created.
|
||||
*/
|
||||
mozilla::URLExtraData* DefaultStyleAttrURLData();
|
||||
|
||||
/**
|
||||
* Get/Set the base target of a link in a document.
|
||||
*/
|
||||
@ -2984,6 +2994,11 @@ protected:
|
||||
nsCOMPtr<nsIURI> mDocumentBaseURI;
|
||||
nsCOMPtr<nsIURI> mChromeXHRDocBaseURI;
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
// A lazily-constructed URL data for style system to resolve URL value.
|
||||
RefPtr<mozilla::URLExtraData> mCachedURLData;
|
||||
#endif
|
||||
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
|
||||
bool mReferrerPolicySet;
|
||||
|
@ -303,10 +303,6 @@ TabParent::AddWindowListeners()
|
||||
this, false, false);
|
||||
}
|
||||
}
|
||||
if (nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell()) {
|
||||
mPresShellWithRefreshListener = shell;
|
||||
shell->AddPostRefreshObserver(this);
|
||||
}
|
||||
|
||||
RefPtr<AudioChannelService> acs = AudioChannelService::GetOrCreate();
|
||||
if (acs) {
|
||||
@ -326,10 +322,6 @@ TabParent::RemoveWindowListeners()
|
||||
this, false);
|
||||
}
|
||||
}
|
||||
if (mPresShellWithRefreshListener) {
|
||||
mPresShellWithRefreshListener->RemovePostRefreshObserver(this);
|
||||
mPresShellWithRefreshListener = nullptr;
|
||||
}
|
||||
|
||||
RefPtr<AudioChannelService> acs = AudioChannelService::GetOrCreate();
|
||||
if (acs) {
|
||||
@ -337,14 +329,6 @@ TabParent::RemoveWindowListeners()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::DidRefresh()
|
||||
{
|
||||
if (mChromeOffset != -GetChildProcessOffset()) {
|
||||
UpdatePosition();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::GetAppType(nsAString& aOut)
|
||||
{
|
||||
|
@ -90,7 +90,6 @@ class TabParent final : public PBrowserParent
|
||||
, public nsIKeyEventInPluginCallback
|
||||
, public nsSupportsWeakReference
|
||||
, public TabContext
|
||||
, public nsAPostRefreshObserver
|
||||
, public nsIWebBrowserPersistable
|
||||
, public LiveResizeListener
|
||||
{
|
||||
@ -158,8 +157,6 @@ public:
|
||||
|
||||
void AddWindowListeners();
|
||||
|
||||
void DidRefresh() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvMoveFocus(const bool& aForward,
|
||||
const bool& aForDocumentNavigation) override;
|
||||
|
||||
@ -750,8 +747,6 @@ private:
|
||||
// cursor. This happens whenever the cursor is in the tab's region.
|
||||
bool mTabSetsCursor;
|
||||
|
||||
RefPtr<nsIPresShell> mPresShellWithRefreshListener;
|
||||
|
||||
bool mHasContentOpener;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "mozilla/URLExtraData.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Use)
|
||||
|
||||
@ -327,10 +328,13 @@ SVGUseElement::CreateAnonymousContent()
|
||||
}
|
||||
|
||||
// Store the base URI
|
||||
mContentBaseURI = targetContent->GetBaseURI();
|
||||
if (!mContentBaseURI) {
|
||||
nsCOMPtr<nsIURI> baseURI = targetContent->GetBaseURI();
|
||||
if (!baseURI) {
|
||||
return nullptr;
|
||||
}
|
||||
mContentURLData = new URLExtraData(baseURI.forget(),
|
||||
do_AddRef(OwnerDoc()->GetDocumentURI()),
|
||||
do_AddRef(NodePrincipal()));
|
||||
|
||||
targetContent->AddMutationObserver(this);
|
||||
mClone = newcontent;
|
||||
|
@ -26,6 +26,8 @@ nsresult NS_NewSVGUseElement(nsIContent **aResult,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
||||
namespace mozilla {
|
||||
struct URLExtraData;
|
||||
|
||||
namespace dom {
|
||||
|
||||
typedef SVGGraphicsElement SVGUseElementBase;
|
||||
@ -77,7 +79,7 @@ public:
|
||||
already_AddRefed<SVGAnimatedLength> Height();
|
||||
|
||||
nsIURI* GetSourceDocURI();
|
||||
nsIURI* GetContentBaseURI() const { return mContentBaseURI; }
|
||||
URLExtraData* GetContentURLData() const { return mContentURLData; }
|
||||
|
||||
protected:
|
||||
class SourceReference : public nsReferencedElement {
|
||||
@ -120,7 +122,7 @@ protected:
|
||||
nsCOMPtr<nsIContent> mOriginal; // if we've been cloned, our "real" copy
|
||||
nsCOMPtr<nsIContent> mClone; // cloned tree
|
||||
SourceReference mSource; // observed element
|
||||
nsCOMPtr<nsIURI> mContentBaseURI; // Base URI for its anonymous content
|
||||
RefPtr<URLExtraData> mContentURLData; // URL data for its anonymous content
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -1234,8 +1234,8 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
|
||||
} else {
|
||||
NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
|
||||
// FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
|
||||
RefPtr<css::URLExtraData> data =
|
||||
new css::URLExtraData(mBaseURI, mDocURI, mElement->NodePrincipal());
|
||||
RefPtr<URLExtraData> data = new URLExtraData(mBaseURI, mDocURI,
|
||||
mElement->NodePrincipal());
|
||||
// FIXME (bug 1342559): Set SVG parsing mode for lengths
|
||||
changed = Servo_DeclarationBlock_SetPropertyById(mDecl->AsServo()->Raw(), propertyID,
|
||||
&value, false, data);
|
||||
|
@ -7,4 +7,3 @@ MOZ_APP_NAME=geckoembed
|
||||
MOZ_APP_DISPLAYNAME=GeckoEmbed
|
||||
MOZ_UPDATER=
|
||||
MOZ_APP_VERSION=$MOZILLA_VERSION
|
||||
MOZ_EXTENSIONS_DEFAULT=" gio"
|
||||
|
@ -58,3 +58,7 @@ USE_LIBS += [
|
||||
'brotli',
|
||||
'woff2',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/modules/woff2/src',
|
||||
]
|
||||
|
@ -10,7 +10,4 @@ SOURCES += [
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['MOZ_ENABLE_GNOMEUI']:
|
||||
CXXFLAGS += CONFIG['MOZ_GNOMEUI_CFLAGS']
|
||||
else:
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
@ -12,9 +12,7 @@
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef MOZ_ENABLE_GIO
|
||||
#include <gio/gio.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@ -168,7 +166,6 @@ moz_gtk_icon_size(const char* name)
|
||||
return GTK_ICON_SIZE_MENU;
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_GIO
|
||||
static int32_t
|
||||
GetIconSize(nsIMozIconURI* aIconURI)
|
||||
{
|
||||
@ -301,7 +298,6 @@ nsIconChannel::InitWithGIO(nsIMozIconURI* aIconURI)
|
||||
g_object_unref(buf);
|
||||
return rv;
|
||||
}
|
||||
#endif // MOZ_ENABLE_GIO
|
||||
|
||||
nsresult
|
||||
nsIconChannel::Init(nsIURI* aURI)
|
||||
@ -316,11 +312,7 @@ nsIconChannel::Init(nsIURI* aURI)
|
||||
nsAutoCString stockIcon;
|
||||
iconURI->GetStockIcon(stockIcon);
|
||||
if (stockIcon.IsEmpty()) {
|
||||
#ifdef MOZ_ENABLE_GIO
|
||||
return InitWithGIO(iconURI);
|
||||
#else
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Search for stockIcon
|
||||
|
@ -15,10 +15,12 @@ OSPreferences::ReadSystemLocales(nsTArray<nsCString>& aLocaleList)
|
||||
//XXX: This is a quite sizable hack to work around the fact that we cannot
|
||||
// retrieve OS locale in C++ without reaching out to JNI.
|
||||
// Once we fix this (bug 1337078), this hack should not be necessary.
|
||||
nsAutoCString locale;
|
||||
if (!NS_SUCCEEDED(Preferences::GetCString("intl.locale.os", &locale)) ||
|
||||
locale.IsEmpty()) {
|
||||
locale.AssignLiteral("en-US");
|
||||
//
|
||||
//XXX: Notice, this value may be empty on an early read. In that case
|
||||
// we won't add anything to the return list so that it doesn't get
|
||||
// cached in mSystemLocales.
|
||||
nsAdoptingCString locale = Preferences::GetCString("intl.locale.os");
|
||||
if (!locale.IsEmpty()) {
|
||||
aLocaleList.AppendElement(locale);
|
||||
}
|
||||
return true;
|
||||
|
@ -45,6 +45,7 @@ add_test(function test_getAppLocalesAsLangTags() {
|
||||
|
||||
const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
|
||||
const PREF_SELECTED_LOCALE = "general.useragent.locale";
|
||||
const PREF_OS_LOCALE = "intl.locale.os";
|
||||
const REQ_LOC_CHANGE_EVENT = "intl:requested-locales-changed";
|
||||
|
||||
add_test(function test_getRequestedLocales() {
|
||||
@ -67,6 +68,7 @@ add_test(function test_getRequestedLocales_matchOS() {
|
||||
|
||||
Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
|
||||
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "ar-IR");
|
||||
Services.prefs.setCharPref(PREF_OS_LOCALE, "en-US");
|
||||
|
||||
const observer = {
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
@ -138,6 +140,7 @@ add_test(function test_isAppLocaleRTL() {
|
||||
});
|
||||
|
||||
do_register_cleanup(() => {
|
||||
Services.prefs.clearUserPref(PREF_SELECTED_LOCALE);
|
||||
Services.prefs.clearUserPref(PREF_MATCH_OS_LOCALE);
|
||||
Services.prefs.clearUserPref(PREF_SELECTED_LOCALE);
|
||||
Services.prefs.clearUserPref(PREF_MATCH_OS_LOCALE);
|
||||
Services.prefs.clearUserPref(PREF_OS_LOCALE, "en-US");
|
||||
});
|
||||
|
@ -3055,15 +3055,10 @@ ElementRestyler::ComputeStyleChangeFor(nsIFrame* aFrame,
|
||||
nsTArray<RefPtr<nsStyleContext>>&
|
||||
aSwappedStructOwners)
|
||||
{
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
std::string elemDesc;
|
||||
if (profiler_is_active() && content) {
|
||||
elemDesc = ToString(*content);
|
||||
}
|
||||
PROFILER_LABEL("ElementRestyler", "ComputeStyleChangeFor",
|
||||
js::ProfileEntry::Category::CSS);
|
||||
|
||||
PROFILER_LABEL_DYNAMIC("ElementRestyler", "ComputeStyleChangeFor",
|
||||
js::ProfileEntry::Category::CSS,
|
||||
content ? elemDesc.c_str() : "<unknown>");
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (aMinChange) {
|
||||
aChangeList->AppendChange(aFrame, content, aMinChange);
|
||||
}
|
||||
|
@ -183,7 +183,6 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
|
||||
/* static */ uint32_t nsLayoutUtils::sZoomMaxPercent;
|
||||
/* static */ uint32_t nsLayoutUtils::sZoomMinPercent;
|
||||
/* static */ bool nsLayoutUtils::sInvalidationDebuggingIsEnabled;
|
||||
/* static */ bool nsLayoutUtils::sCSSVariablesEnabled;
|
||||
/* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
|
||||
/* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
|
||||
/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
|
||||
@ -7721,8 +7720,6 @@ nsLayoutUtils::Initialize()
|
||||
"zoom.minPercent", 30);
|
||||
Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled,
|
||||
"nglayout.debug.invalidation");
|
||||
Preferences::AddBoolVarCache(&sCSSVariablesEnabled,
|
||||
"layout.css.variables.enabled");
|
||||
Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
|
||||
"layout.interruptible-reflow.enabled");
|
||||
Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
|
||||
|
@ -2337,14 +2337,6 @@ public:
|
||||
*/
|
||||
static bool IsTextAlignUnsafeValueEnabled();
|
||||
|
||||
/**
|
||||
* Checks if CSS variables are currently enabled.
|
||||
*/
|
||||
static bool CSSVariablesEnabled()
|
||||
{
|
||||
return sCSSVariablesEnabled;
|
||||
}
|
||||
|
||||
static bool InterruptibleReflowEnabled()
|
||||
{
|
||||
return sInterruptibleReflowEnabled;
|
||||
@ -2944,7 +2936,6 @@ private:
|
||||
static uint32_t sZoomMaxPercent;
|
||||
static uint32_t sZoomMinPercent;
|
||||
static bool sInvalidationDebuggingIsEnabled;
|
||||
static bool sCSSVariablesEnabled;
|
||||
static bool sInterruptibleReflowEnabled;
|
||||
static bool sSVGTransformBoxEnabled;
|
||||
static bool sTextCombineUprightDigitsEnabled;
|
||||
|
@ -695,6 +695,12 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
||||
nsDependentCString prefName(aPrefName);
|
||||
if (prefName.EqualsLiteral("layout.css.dpi") ||
|
||||
prefName.EqualsLiteral("layout.css.devPixelsPerPx")) {
|
||||
|
||||
// We can't use a separate observer, callback, or var cache
|
||||
// Because they don't guarantee the order of function calls.
|
||||
// We have to update the scale override value first.
|
||||
nsIWidget::ScaleOverrideChanged();
|
||||
|
||||
int32_t oldAppUnitsPerDevPixel = AppUnitsPerDevPixel();
|
||||
if (mDeviceContext->CheckDPIChange() && mShell) {
|
||||
nsCOMPtr<nsIPresShell> shell = mShell;
|
||||
|
@ -132,6 +132,7 @@ using namespace mozilla::system;
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/StaticPresData.h"
|
||||
#include "mozilla/dom/WebIDLGlobalNameHash.h"
|
||||
#include "mozilla/URLExtraData.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::net;
|
||||
@ -312,7 +313,8 @@ nsLayoutStatics::Initialize()
|
||||
mozilla::dom::WebCryptoThreadPool::Initialize();
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
Servo_Initialize();
|
||||
URLExtraData::InitDummy();
|
||||
Servo_Initialize(URLExtraData::Dummy());
|
||||
#endif
|
||||
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
@ -331,6 +333,7 @@ nsLayoutStatics::Shutdown()
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
Servo_Shutdown();
|
||||
URLExtraData::ReleaseDummy();
|
||||
#endif
|
||||
|
||||
nsMessageManagerScriptExecutor::Shutdown();
|
||||
|
@ -45,4 +45,5 @@ LOCAL_INCLUDES += [
|
||||
'../style',
|
||||
'/dom/base',
|
||||
'/dom/xbl',
|
||||
'/modules/brotli/dec',
|
||||
]
|
||||
|
@ -1,5 +1,4 @@
|
||||
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
|
||||
default-preferences pref(layout.css.variables.enabled,true)
|
||||
|
||||
== variables-ruletree-cache-01.html variables-ruletree-cache-01.html
|
||||
== variables-ruletree-cache-02.html variables-ruletree-cache-02.html
|
||||
|
@ -1,4 +1,2 @@
|
||||
default-preferences pref(layout.css.variables.enabled,true)
|
||||
|
||||
== variables-ruletree-cache-01.html variables-ruletree-cache-01-ref.html
|
||||
== variables-ruletree-cache-02.html variables-ruletree-cache-02-ref.html
|
||||
|
@ -1,5 +1,4 @@
|
||||
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
|
||||
default-preferences pref(layout.css.variables.enabled,true)
|
||||
|
||||
== variable-declaration-01.html variable-declaration-01.html
|
||||
== variable-declaration-02.html variable-declaration-02.html
|
||||
|
@ -1,5 +1,3 @@
|
||||
default-preferences pref(layout.css.variables.enabled,true)
|
||||
|
||||
== variable-declaration-01.html support/color-green-ref.html
|
||||
== variable-declaration-02.html support/color-green-ref.html
|
||||
== variable-declaration-03.html support/color-green-ref.html
|
||||
|
@ -286,7 +286,8 @@ SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
|
||||
ServoComputedValuesBorrowedOrNull parent_style)
|
||||
|
||||
// Initialize Servo components. Should be called exactly once at startup.
|
||||
SERVO_BINDING_FUNC(Servo_Initialize, void)
|
||||
SERVO_BINDING_FUNC(Servo_Initialize, void,
|
||||
RawGeckoURLExtraData* dummy_url_data)
|
||||
// Shut down Servo components. Should be called exactly once at shutdown.
|
||||
SERVO_BINDING_FUNC(Servo_Shutdown, void)
|
||||
|
||||
|
@ -20,11 +20,9 @@ struct RawServoStyleSet;
|
||||
#undef SERVO_ARC_TYPE
|
||||
|
||||
namespace mozilla {
|
||||
class ServoElementSnapshot;
|
||||
struct StyleAnimation;
|
||||
namespace css {
|
||||
class ServoElementSnapshot;
|
||||
struct StyleAnimation;
|
||||
struct URLExtraData;
|
||||
} // namespace css
|
||||
namespace dom {
|
||||
class Element;
|
||||
class StyleChildrenIterator;
|
||||
@ -50,7 +48,7 @@ typedef nsINode RawGeckoNode;
|
||||
typedef mozilla::dom::Element RawGeckoElement;
|
||||
typedef nsIDocument RawGeckoDocument;
|
||||
typedef nsPresContext RawGeckoPresContext;
|
||||
typedef mozilla::css::URLExtraData RawGeckoURLExtraData;
|
||||
typedef mozilla::URLExtraData RawGeckoURLExtraData;
|
||||
typedef nsTArray<mozilla::Keyframe> RawGeckoKeyframeList;
|
||||
typedef nsTArray<mozilla::ComputedKeyframeValues> RawGeckoComputedKeyframeValuesList;
|
||||
typedef nsTArray<mozilla::PropertyStyleAnimationValuePair> RawGeckoAnimationValueList;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
#include "ChildIterator.h"
|
||||
#include "NullPrincipalURI.h"
|
||||
#include "gfxFontFamilyList.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
@ -1353,7 +1352,7 @@ Gecko_NewURLValue(ServoBundledURI aURI)
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(css::URLValue, CSSURLValue);
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(css::URLExtraData, URLExtraData);
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(URLExtraData, URLExtraData);
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
|
||||
|
||||
@ -1627,15 +1626,6 @@ Gecko_LoadStyleSheet(css::Loader* aLoader,
|
||||
aLoader->LoadChildSheet(aParent, uri, media, nullptr, aChildSheet, nullptr);
|
||||
}
|
||||
|
||||
RawGeckoURLExtraData*
|
||||
Gecko_URLExtraData_CreateDummy()
|
||||
{
|
||||
RefPtr<css::URLExtraData> data =
|
||||
new css::URLExtraData(NullPrincipalURI::Create(), nullptr,
|
||||
NullPrincipal::Create());
|
||||
return data.forget().take();
|
||||
}
|
||||
|
||||
const nsMediaFeature*
|
||||
Gecko_GetMediaFeatures()
|
||||
{
|
||||
|
@ -69,8 +69,10 @@ struct nsStyleDisplay;
|
||||
void Gecko_##name_##_AddRef(class_* aPtr); \
|
||||
void Gecko_##name_##_Release(class_* aPtr);
|
||||
#define NS_IMPL_FFI_REFCOUNTING(class_, name_) \
|
||||
void Gecko_##name_##_AddRef(class_* aPtr) { NS_ADDREF(aPtr); } \
|
||||
void Gecko_##name_##_Release(class_* aPtr) { NS_RELEASE(aPtr); }
|
||||
void Gecko_##name_##_AddRef(class_* aPtr) \
|
||||
{ MOZ_ASSERT(NS_IsMainThread()); NS_ADDREF(aPtr); } \
|
||||
void Gecko_##name_##_Release(class_* aPtr) \
|
||||
{ MOZ_ASSERT(NS_IsMainThread()); NS_RELEASE(aPtr); }
|
||||
|
||||
#define DEFINE_ARRAY_TYPE_FOR(type_) \
|
||||
struct nsTArrayBorrowed_##type_ { \
|
||||
@ -89,7 +91,7 @@ public:
|
||||
already_AddRefed<mozilla::css::URLValue> IntoCssUrl();
|
||||
const uint8_t* mURLString;
|
||||
uint32_t mURLStringLength;
|
||||
mozilla::css::URLExtraData* mExtraData;
|
||||
mozilla::URLExtraData* mExtraData;
|
||||
};
|
||||
|
||||
// DOM Traversal.
|
||||
@ -119,10 +121,6 @@ void Gecko_LoadStyleSheet(mozilla::css::Loader* loader,
|
||||
const uint8_t* media_bytes,
|
||||
uint32_t media_length);
|
||||
|
||||
// URLExtraData
|
||||
// Create a new addrefed URLExtraData.
|
||||
RawGeckoURLExtraData* Gecko_URLExtraData_CreateDummy();
|
||||
|
||||
// By default, Servo walks the DOM by traversing the siblings of the DOM-view
|
||||
// first child. This generally works, but misses anonymous children, which we
|
||||
// want to traverse during styling. To support these cases, we create an
|
||||
|
@ -13,7 +13,7 @@ namespace mozilla {
|
||||
|
||||
/* static */ already_AddRefed<ServoDeclarationBlock>
|
||||
ServoDeclarationBlock::FromCssText(const nsAString& aCssText,
|
||||
css::URLExtraData* aExtraData)
|
||||
URLExtraData* aExtraData)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 value(aCssText);
|
||||
// FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServoDeclarationBlock)
|
||||
|
||||
static already_AddRefed<ServoDeclarationBlock>
|
||||
FromCssText(const nsAString& aCssText, css::URLExtraData* aExtraData);
|
||||
FromCssText(const nsAString& aCssText, URLExtraData* aExtraData);
|
||||
|
||||
RawServoDeclarationBlock* Raw() const { return mRaw; }
|
||||
RawServoDeclarationBlock* const* RefRaw() const {
|
||||
|
@ -94,9 +94,17 @@ void
|
||||
ServoStyleRuleDeclaration::GetCSSParsingEnvironment(
|
||||
CSSParsingEnvironment& aCSSParseEnv)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("GetCSSParsingEnvironment "
|
||||
"shouldn't be calling for a Servo rule");
|
||||
GetCSSParsingEnvironmentForRule(Rule(), aCSSParseEnv);
|
||||
}
|
||||
|
||||
URLExtraData*
|
||||
ServoStyleRuleDeclaration::GetURLData() const
|
||||
{
|
||||
return GetURLDataForRule(Rule());
|
||||
}
|
||||
|
||||
// -- ServoStyleRule --------------------------------------------------
|
||||
|
||||
ServoStyleRule::ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule)
|
||||
|
@ -33,6 +33,7 @@ protected:
|
||||
nsresult SetCSSDeclaration(DeclarationBlock* aDecl) final;
|
||||
nsIDocument* DocToUpdate() final;
|
||||
void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) final;
|
||||
URLExtraData* GetURLData() const final;
|
||||
|
||||
private:
|
||||
// For accessing the constructor.
|
||||
@ -43,6 +44,7 @@ private:
|
||||
~ServoStyleRuleDeclaration();
|
||||
|
||||
inline ServoStyleRule* Rule();
|
||||
inline const ServoStyleRule* Rule() const;
|
||||
|
||||
RefPtr<ServoDeclarationBlock> mDecls;
|
||||
};
|
||||
@ -88,8 +90,15 @@ private:
|
||||
ServoStyleRule*
|
||||
ServoStyleRuleDeclaration::Rule()
|
||||
{
|
||||
return reinterpret_cast<ServoStyleRule*>(reinterpret_cast<uint8_t*>(this) -
|
||||
offsetof(ServoStyleRule, mDecls));
|
||||
return reinterpret_cast<ServoStyleRule*>(
|
||||
reinterpret_cast<uint8_t*>(this) - offsetof(ServoStyleRule, mDecls));
|
||||
}
|
||||
|
||||
const ServoStyleRule*
|
||||
ServoStyleRuleDeclaration::Rule() const
|
||||
{
|
||||
return reinterpret_cast<const ServoStyleRule*>(
|
||||
reinterpret_cast<const uint8_t*>(this) - offsetof(ServoStyleRule, mDecls));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -87,8 +87,8 @@ ServoStyleSheet::ParseSheet(css::Loader* aLoader,
|
||||
nsIPrincipal* aSheetPrincipal,
|
||||
uint32_t aLineNumber)
|
||||
{
|
||||
RefPtr<css::URLExtraData> extraData =
|
||||
new css::URLExtraData(aBaseURI, aSheetURI, aSheetPrincipal);
|
||||
RefPtr<URLExtraData> extraData =
|
||||
new URLExtraData(aBaseURI, aSheetURI, aSheetPrincipal);
|
||||
|
||||
NS_ConvertUTF16toUTF8 input(aInput);
|
||||
if (!Inner()->mSheet) {
|
||||
@ -100,6 +100,7 @@ ServoStyleSheet::ParseSheet(css::Loader* aLoader,
|
||||
this, &input, extraData);
|
||||
}
|
||||
|
||||
Inner()->mURLData = extraData.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -107,6 +108,7 @@ void
|
||||
ServoStyleSheet::LoadFailed()
|
||||
{
|
||||
Inner()->mSheet = Servo_StyleSheet_Empty(mParsingMode).Consume();
|
||||
Inner()->mURLData = URLExtraData::Dummy();
|
||||
}
|
||||
|
||||
// nsICSSLoaderObserver implementation
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInfo.h"
|
||||
#include "mozilla/URLExtraData.h"
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -33,6 +34,13 @@ struct ServoStyleSheetInner : public StyleSheetInfo
|
||||
const dom::SRIMetadata& aIntegrity);
|
||||
|
||||
RefPtr<const RawServoStyleSheet> mSheet;
|
||||
// XXX StyleSheetInfo already has mSheetURI, mBaseURI, and mPrincipal.
|
||||
// Can we somehow replace them with URLExtraData directly? The issue
|
||||
// is currently URLExtraData is immutable, but URIs in StyleSheetInfo
|
||||
// seems to be mutable, so we probably cannot set them altogether.
|
||||
// Also, this is mostly a duplicate reference of the same url data
|
||||
// inside RawServoStyleSheet. We may want to just use that instead.
|
||||
RefPtr<URLExtraData> mURLData;
|
||||
};
|
||||
|
||||
|
||||
@ -74,6 +82,8 @@ public:
|
||||
Inner()->mSheet = aSheet;
|
||||
}
|
||||
|
||||
URLExtraData* URLData() const { return Inner()->mURLData; }
|
||||
|
||||
// WebIDL CSSStyleSheet API
|
||||
// Can't be inline because we can't include ImportRule here. And can't be
|
||||
// called GetOwnerRule because that would be ambiguous with the ImportRule
|
||||
|
@ -1062,6 +1062,7 @@ public:
|
||||
virtual DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
|
||||
virtual nsresult SetCSSDeclaration(DeclarationBlock* aDecl) override;
|
||||
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
|
||||
URLExtraData* GetURLData() const final;
|
||||
virtual nsIDocument* DocToUpdate() override;
|
||||
|
||||
// Override |AddRef| and |Release| for being owned by StyleRule. Also, we
|
||||
@ -1120,6 +1121,13 @@ DOMCSSDeclarationImpl::GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParse
|
||||
GetCSSParsingEnvironmentForRule(mRule, aCSSParseEnv);
|
||||
}
|
||||
|
||||
URLExtraData*
|
||||
DOMCSSDeclarationImpl::GetURLData() const
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("GetURLData shouldn't be calling on a Gecko rule");
|
||||
return GetURLDataForRule(mRule);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMCSSDeclarationImpl::GetParentRule(nsIDOMCSSRule **aParent)
|
||||
{
|
||||
|
41
layout/style/URLExtraData.cpp
Normal file
41
layout/style/URLExtraData.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
/* thread-safe container of information for resolving url values */
|
||||
|
||||
#include "mozilla/URLExtraData.h"
|
||||
|
||||
#include "nsProxyRelease.h"
|
||||
#include "NullPrincipalURI.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
StaticRefPtr<URLExtraData> URLExtraData::sDummy;
|
||||
|
||||
/* static */ void
|
||||
URLExtraData::InitDummy()
|
||||
{
|
||||
sDummy = new URLExtraData(NullPrincipalURI::Create(),
|
||||
nullptr,
|
||||
NullPrincipal::Create());
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
URLExtraData::ReleaseDummy()
|
||||
{
|
||||
sDummy = nullptr;
|
||||
}
|
||||
|
||||
URLExtraData::~URLExtraData()
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
NS_ReleaseOnMainThread(mBaseURI.forget());
|
||||
NS_ReleaseOnMainThread(mReferrer.forget());
|
||||
NS_ReleaseOnMainThread(mPrincipal.forget());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
63
layout/style/URLExtraData.h
Normal file
63
layout/style/URLExtraData.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
/* thread-safe container of information for resolving url values */
|
||||
|
||||
#ifndef mozilla_URLExtraData_h
|
||||
#define mozilla_URLExtraData_h
|
||||
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct URLExtraData
|
||||
{
|
||||
URLExtraData(already_AddRefed<nsIURI> aBaseURI,
|
||||
already_AddRefed<nsIURI> aReferrer,
|
||||
already_AddRefed<nsIPrincipal> aPrincipal)
|
||||
: mBaseURI(Move(aBaseURI))
|
||||
, mReferrer(Move(aReferrer))
|
||||
, mPrincipal(Move(aPrincipal))
|
||||
{
|
||||
MOZ_ASSERT(mBaseURI);
|
||||
}
|
||||
|
||||
URLExtraData(nsIURI* aBaseURI, nsIURI* aReferrer, nsIPrincipal* aPrincipal)
|
||||
: URLExtraData(do_AddRef(aBaseURI),
|
||||
do_AddRef(aReferrer),
|
||||
do_AddRef(aPrincipal)) {}
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLExtraData)
|
||||
|
||||
nsIURI* BaseURI() const { return mBaseURI; }
|
||||
nsIURI* GetReferrer() const { return mReferrer; }
|
||||
nsIPrincipal* GetPrincipal() const { return mPrincipal; }
|
||||
|
||||
static URLExtraData* Dummy() {
|
||||
MOZ_ASSERT(sDummy);
|
||||
return sDummy;
|
||||
}
|
||||
static void InitDummy();
|
||||
static void ReleaseDummy();
|
||||
|
||||
private:
|
||||
~URLExtraData();
|
||||
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
|
||||
static StaticRefPtr<URLExtraData> sDummy;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_URLExtraData_h
|
@ -123,6 +123,7 @@ EXPORTS.mozilla += [
|
||||
'StyleSheet.h',
|
||||
'StyleSheetInfo.h',
|
||||
'StyleSheetInlines.h',
|
||||
'URLExtraData.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
@ -229,6 +230,7 @@ UNIFIED_SOURCES += [
|
||||
'StyleAnimationValue.cpp',
|
||||
'StyleRule.cpp',
|
||||
'StyleSheet.cpp',
|
||||
'URLExtraData.cpp',
|
||||
]
|
||||
|
||||
# - nsLayoutStylesheetCache.cpp needs to be built separately because it uses
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user