зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to inbound. a=merge CLOSED TREE
This commit is contained in:
Коммит
7b43ef6086
|
@ -225,6 +225,11 @@
|
|||
<true/>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.productivity</string>
|
||||
<key>LSEnvironment</key>
|
||||
<dict>
|
||||
<key>MallocNanoZone</key>
|
||||
<string>0</string>
|
||||
</dict>
|
||||
<key>LSFileQuarantineEnabled</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
@ -84,6 +84,11 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
|
|||
'user32.dll',
|
||||
]
|
||||
|
||||
if CONFIG['CC_TYPE'] == "msvc":
|
||||
CFLAGS += ['-guard:cf']
|
||||
CXXFLAGS += ['-guard:cf']
|
||||
LDFLAGS += ['-guard:cf']
|
||||
|
||||
# Control the default heap size.
|
||||
# This is the heap returned by GetProcessHeap().
|
||||
# As we use the CRT heap, the default size is too large and wastes VM.
|
||||
|
|
|
@ -1333,7 +1333,12 @@ pref("security.insecure_field_warning.contextual.enabled", true);
|
|||
|
||||
// Show degraded UI for http pages; disabled for now
|
||||
pref("security.insecure_connection_icon.enabled", false);
|
||||
// Show degraded UI for http pages in private mode only for Nightly: Bug 1434626
|
||||
#if defined(NIGHTLY_BUILD)
|
||||
pref("security.insecure_connection_icon.pbmode.enabled", true);
|
||||
#else
|
||||
pref("security.insecure_connection_icon.pbmode.enabled", false);
|
||||
#endif
|
||||
|
||||
// Show "Not Secure" text for http pages; disabled for now
|
||||
pref("security.insecure_connection_text.enabled", false);
|
||||
|
@ -1728,7 +1733,7 @@ pref("extensions.formautofill.heuristics.enabled", true);
|
|||
pref("extensions.formautofill.section.enabled", true);
|
||||
pref("extensions.formautofill.loglevel", "Warn");
|
||||
// Comma separated list of countries Form Autofill supports
|
||||
#ifdef MOZ_UPDATE_CHANNEL == release
|
||||
#if MOZ_UPDATE_CHANNEL == release
|
||||
pref("extensions.formautofill.supportedCountries", "US");
|
||||
pref("extensions.formautofill.supportRTL", false);
|
||||
#else
|
||||
|
|
|
@ -2,7 +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/. */
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/* import-globals-from ../../../../toolkit/content/globalOverlay.js */
|
||||
|
@ -238,7 +237,7 @@ const nsICacheStorageService = Components.interfaces.nsICacheStorageService;
|
|||
const nsICacheStorage = Components.interfaces.nsICacheStorage;
|
||||
const cacheService = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"].getService(nsICacheStorageService);
|
||||
|
||||
var loadContextInfo = LoadContextInfo.fromLoadContext(
|
||||
var loadContextInfo = Services.loadContextInfo.fromLoadContext(
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsILoadContext), false);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
var {LoadContextInfo} = ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "FormHistory",
|
||||
"resource://gre/modules/FormHistory.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
||||
|
@ -553,9 +551,9 @@ add_task(async function test_offline_cache() {
|
|||
// Store something to the offline cache
|
||||
var appcacheserv = Cc["@mozilla.org/network/application-cache-service;1"]
|
||||
.getService(Ci.nsIApplicationCacheService);
|
||||
var appcachegroupid = appcacheserv.buildGroupIDForInfo(makeURI(URL + "/manifest"), LoadContextInfo.default);
|
||||
var appcachegroupid = appcacheserv.buildGroupIDForInfo(makeURI(URL + "/manifest"), Services.loadContextInfo.default);
|
||||
var appcache = appcacheserv.createApplicationCache(appcachegroupid);
|
||||
var storage = Services.cache2.appCacheStorage(LoadContextInfo.default, appcache);
|
||||
var storage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, appcache);
|
||||
|
||||
// Open the dialog
|
||||
let wh = new WindowHelper();
|
||||
|
|
|
@ -27,8 +27,7 @@ function promiseNoCacheEntry(filename) {
|
|||
};
|
||||
function Visitor() {}
|
||||
|
||||
let {LoadContextInfo} = ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm", null);
|
||||
let storage = Services.cache2.diskCacheStorage(LoadContextInfo.default, false);
|
||||
let storage = Services.cache2.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
storage.asyncVisitStorage(new Visitor(), true /* Do walk entries */);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,12 +9,18 @@ pref("startup.homepage_welcome_url.additional", "");
|
|||
pref("app.update.interval", 43200); // 12 hours
|
||||
// Give the user x seconds to react before showing the big UI. default=192 hours
|
||||
pref("app.update.promptWaitTime", 691200);
|
||||
// URL user can browse to manually if for some reason all update installation
|
||||
// attempts fail.
|
||||
// app.update.url.manual: URL user can browse to manually if for some reason
|
||||
// all update installation attempts fail.
|
||||
// app.update.url.details: a default value for the "More information about this
|
||||
// update" link supplied in the "An update is available" page of the update
|
||||
// wizard.
|
||||
#if MOZ_UPDATE_CHANNEL == beta
|
||||
pref("app.update.url.manual", "https://www.mozilla.org/firefox/beta");
|
||||
pref("app.update.url.details", "https://www.mozilla.org/%LOCALE%/firefox/beta/notes");
|
||||
#else
|
||||
pref("app.update.url.manual", "https://www.mozilla.org/firefox/");
|
||||
// A default value for the "More information about this update" link
|
||||
// supplied in the "An update is available" page of the update wizard.
|
||||
pref("app.update.url.details", "https://www.mozilla.org/%LOCALE%/firefox/notes");
|
||||
#endif
|
||||
|
||||
pref("app.releaseNotesURL", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/releasenotes/?utm_source=firefox-browser&utm_medium=firefox-browser&utm_campaign=whatsnew");
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
let {LoadContextInfo} = ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
||||
let protocolProxyService = Cc["@mozilla.org/network/protocol-proxy-service;1"]
|
||||
.getService(Ci.nsIProtocolProxyService);
|
||||
|
||||
|
@ -227,17 +226,17 @@ async function doTest(aBrowser) {
|
|||
async function doCheck(aShouldIsolate, aInputA, aInputB) {
|
||||
let expectedEntryCount = 1;
|
||||
let data = [];
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.default));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.private));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, {})));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 1 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 1 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 2 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 2 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.org" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.org" })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.default));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.private));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, {})));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { userContextId: 1 })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { userContextId: 1 })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { userContextId: 2 })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { userContextId: 2 })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(false, { firstPartyDomain: "example.org" })));
|
||||
data = data.concat(await cacheDataForContext(Services.loadContextInfo.custom(true, { firstPartyDomain: "example.org" })));
|
||||
|
||||
if (aShouldIsolate) {
|
||||
expectedEntryCount = 2;
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
let {LoadContextInfo} = ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
||||
|
||||
const TEST_DOMAIN = "http://example.net/";
|
||||
|
||||
let tempScope = {};
|
||||
|
@ -54,11 +52,11 @@ function checkCookiesSanitized(aBrowser) {
|
|||
function checkCacheExists(aShouldExist) {
|
||||
return async function() {
|
||||
let loadContextInfos = [
|
||||
LoadContextInfo.default,
|
||||
LoadContextInfo.custom(false, { userContextId: 1 }),
|
||||
LoadContextInfo.custom(false, { userContextId: 2 }),
|
||||
LoadContextInfo.custom(false, { firstPartyDomain: "example.com" }),
|
||||
LoadContextInfo.custom(false, { firstPartyDomain: "example.org" }),
|
||||
Services.loadContextInfo.default,
|
||||
Services.loadContextInfo.custom(false, { userContextId: 1 }),
|
||||
Services.loadContextInfo.custom(false, { userContextId: 2 }),
|
||||
Services.loadContextInfo.custom(false, { firstPartyDomain: "example.com" }),
|
||||
Services.loadContextInfo.custom(false, { firstPartyDomain: "example.org" }),
|
||||
];
|
||||
let i = 0;
|
||||
for (let loadContextInfo of loadContextInfos) {
|
||||
|
|
|
@ -9,7 +9,6 @@ var Cr = Components.results;
|
|||
var Cu = Components.utils;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||
|
||||
// Import common head.
|
||||
/* import-globals-from ../../../../../toolkit/components/places/tests/head_common.js */
|
||||
|
|
|
@ -124,7 +124,7 @@ function getFormHistoryCount() {
|
|||
|
||||
function storeCache(aURL, aContent) {
|
||||
let cache = Services.cache2;
|
||||
let storage = cache.diskCacheStorage(LoadContextInfo.default, false);
|
||||
let storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
|
||||
return new Promise(resolve => {
|
||||
let storeCacheListener = {
|
||||
|
@ -159,7 +159,7 @@ function storeCache(aURL, aContent) {
|
|||
|
||||
function checkCache(aURL) {
|
||||
let cache = Services.cache2;
|
||||
let storage = cache.diskCacheStorage(LoadContextInfo.default, false);
|
||||
let storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
|
||||
return new Promise(resolve => {
|
||||
let checkCacheListener = {
|
||||
|
|
|
@ -13,7 +13,6 @@ ChromeUtils.import("resource:///modules/ShellService.jsm");
|
|||
ChromeUtils.import("resource:///modules/TransientPrefs.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "CloudStorage",
|
||||
"resource://gre/modules/CloudStorage.jsm");
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
// This test covers MozTrap test 6047
|
||||
// bug 880621
|
||||
|
||||
var {LoadContextInfo} = ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm", null);
|
||||
|
||||
var tmp = {};
|
||||
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/sanitize.js", tmp);
|
||||
|
@ -65,10 +63,10 @@ function getStorageEntryCount(device, goon) {
|
|||
var storage;
|
||||
switch (device) {
|
||||
case "private":
|
||||
storage = Services.cache2.diskCacheStorage(LoadContextInfo.private, false);
|
||||
storage = Services.cache2.diskCacheStorage(Services.loadContextInfo.private, false);
|
||||
break;
|
||||
case "regular":
|
||||
storage = Services.cache2.diskCacheStorage(LoadContextInfo.default, false);
|
||||
storage = Services.cache2.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
break;
|
||||
default:
|
||||
throw "Unknown device " + device + " at getStorageEntryCount";
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* Tests that preferences are properly set by distribution.ini
|
||||
*/
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||
|
||||
// Import common head.
|
||||
var commonFile = do_get_file("../../../../toolkit/components/places/tests/head_common.js", false);
|
||||
/* import-globals-from ../../../../toolkit/components/places/tests/head_common.js */
|
||||
|
|
|
@ -184,8 +184,7 @@ function FormAutofillTracker(name, engine) {
|
|||
|
||||
FormAutofillTracker.prototype = {
|
||||
__proto__: Tracker.prototype,
|
||||
observe: function observe(subject, topic, data) {
|
||||
Tracker.prototype.observe.call(this, subject, topic, data);
|
||||
async observe(subject, topic, data) {
|
||||
if (topic != "formautofill-storage-changed") {
|
||||
return;
|
||||
}
|
||||
|
@ -214,11 +213,11 @@ FormAutofillTracker.prototype = {
|
|||
// setting a read-only property.
|
||||
set ignoreAll(value) {},
|
||||
|
||||
startTracking() {
|
||||
onStart() {
|
||||
Services.obs.addObserver(this, "formautofill-storage-changed");
|
||||
},
|
||||
|
||||
stopTracking() {
|
||||
onStop() {
|
||||
Services.obs.removeObserver(this, "formautofill-storage-changed");
|
||||
},
|
||||
|
||||
|
|
|
@ -142,6 +142,7 @@ add_task(async function test_outgoing() {
|
|||
},
|
||||
]);
|
||||
|
||||
await engine._tracker.asyncObserver.promiseObserversComplete();
|
||||
// The tracker should have a score recorded for the 2 additions we had.
|
||||
equal(engine._tracker.score, SCORE_INCREMENT_XLARGE * 2);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
this.EXPORTED_SYMBOLS = ["OfflineAppCacheHelper"];
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -12,7 +12,7 @@ const Ci = Components.interfaces;
|
|||
this.OfflineAppCacheHelper = {
|
||||
clear() {
|
||||
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
|
||||
var appCacheStorage = cacheService.appCacheStorage(LoadContextInfo.default, null);
|
||||
var appCacheStorage = cacheService.appCacheStorage(Services.loadContextInfo.default, null);
|
||||
try {
|
||||
appCacheStorage.asyncEvictStorage(null);
|
||||
} catch (er) {}
|
||||
|
|
|
@ -16,7 +16,6 @@ allprojects {
|
|||
topobjdir = gradle.mozconfig.topobjdir
|
||||
|
||||
compileSdkVersion = tryInt(mozconfig.substs.ANDROID_COMPILE_SDK_VERSION)
|
||||
buildToolsVersion = tryInt(mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION)
|
||||
targetSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK)
|
||||
minSdkVersion = tryInt(mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION)
|
||||
manifestPlaceholders = [
|
||||
|
@ -52,9 +51,8 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
// Provided in tree.
|
||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,28 +70,18 @@ redistributed publicly.)
|
|||
|
||||
Archiving the Gradle executable is straight-forward, but archiving a
|
||||
local Maven repository is not. Therefore a special Task Cluster
|
||||
Docker image and job exist for producing the required archives. The
|
||||
Docker image definition is rooted in
|
||||
``taskcluster/docker/android-build``. The Task Cluster job
|
||||
definition is in
|
||||
``testing/taskcluster/tasks/builds/android_api_16_gradle_dependencies.yml``.
|
||||
The job runs in a container based on the custom Docker image and
|
||||
spawns a Sonatype Nexus proxying Maven repository process in the
|
||||
background. The job builds Firefox for Android using Gradle and the
|
||||
in-tree Gradle configuration rooted at ``build.gradle``. The spawned
|
||||
proxying Maven repository downloads external dependencies and collects
|
||||
them. After the Gradle build completes, the job archives the Gradle
|
||||
version used to build, and the downloaded Maven repository, and
|
||||
exposes them as Task Cluster artifacts.
|
||||
|
||||
Here is `an example try job fetching these dependencies
|
||||
<https://treeherder.mozilla.org/#/jobs?repo=try&revision=75bc98935147&selectedJob=17793653>`_.
|
||||
The resulting task produced a `Gradle archive
|
||||
<https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fgradle.tar.xz>`_
|
||||
and a `Maven repository archive
|
||||
<https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fjcentral.tar.xz>`_.
|
||||
These archives were then uploaded (manually) to Mozilla automation
|
||||
using tooltool for consumption in Gradle builds.
|
||||
Docker image and toolchain job exist for producing the required
|
||||
archives. The Docker image definition is rooted in
|
||||
``taskcluster/docker/android-build``. The Task Cluster toolchain job
|
||||
is named `android-gradle-dependencies`. The job runs in a container
|
||||
based on the custom Docker image and spawns a Sonatype Nexus proxying
|
||||
Maven repository process in the background. The job builds Firefox
|
||||
for Android using Gradle and the in-tree Gradle configuration rooted
|
||||
at ``build.gradle``. The spawned proxying Maven repository downloads
|
||||
external dependencies and collects them. After the Gradle build
|
||||
completes, the job archives the Gradle version used to build, and the
|
||||
downloaded Maven repository, and exposes them as Task Cluster
|
||||
artifacts.
|
||||
|
||||
To update the version of Gradle in the archive produced, update
|
||||
``gradle/wrapper/gradle-wrapper.properties``. Be sure to also update
|
||||
|
@ -100,12 +90,18 @@ the SHA256 checksum to prevent poisoning the build machines!
|
|||
To update the versions of Gradle dependencies used, update
|
||||
``dependencies`` sections in the in-tree Gradle configuration rooted
|
||||
at ``build.gradle``. Once you are confident your changes build
|
||||
locally, push a fresh try build with an invocation like::
|
||||
locally, push a fresh build to try. The `android-gradle-dependencies`
|
||||
toolchain should run automatically, fetching your new dependencies and
|
||||
wiring them into the appropriate try build jobs.
|
||||
|
||||
$ hg push-to-try -m "try: -b o -p android-api-16-gradle-dependencies"
|
||||
To update the version of Sonatype Nexus, update `NEXUS_VERSION` in the
|
||||
`android-build` Docker image.
|
||||
|
||||
Then `upload your archives to tooltool
|
||||
<https://wiki.mozilla.org/ReleaseEngineering/Applications/Tooltool#How_To_Upload_To_Tooltool>`_,
|
||||
update the in-tree manifests in
|
||||
``mobile/android/config/tooltool-manifests``, and push a fresh try
|
||||
build.
|
||||
To modify the Sonatype Nexus configuration, typically to proxy a new
|
||||
remote Maven repository, modify
|
||||
`taskcluster/scripts/misc/android-gradle-dependencies/nexus.xml`.
|
||||
|
||||
There is also a toolchain job that fetches the Android SDK and related
|
||||
packages. To update the versions of packaged fetched, modify
|
||||
`python/mozboot/mozboot/android-packages.txt` and update the various
|
||||
in-tree versions accordingly.
|
||||
|
|
|
@ -3,39 +3,21 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Tests that the keybindings for opening and closing the inspector work as expected
|
||||
// Can probably make this a shared test that tests all of the tools global keybindings
|
||||
const TEST_URL = "data:text/html,<html><head><title>Test for the " +
|
||||
"highlighter keybindings</title></head><body>" +
|
||||
"<h1>Keybindings!</h1></body></html>"
|
||||
|
||||
// Use the new debugger frontend because the old one swallows the netmonitor shortcut:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1370442#c7
|
||||
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
|
||||
registerCleanupFunction(function* () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
|
||||
});
|
||||
|
||||
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
|
||||
let keysetMap = { };
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
|
||||
let doc;
|
||||
let node;
|
||||
let inspector;
|
||||
let keysetMap = { };
|
||||
|
||||
addTab(TEST_URL).then(function () {
|
||||
doc = gBrowser.contentDocumentAsCPOW;
|
||||
node = doc.querySelector("h1");
|
||||
waitForFocus(setupKeyBindingsTest);
|
||||
});
|
||||
|
||||
function buildDevtoolsKeysetMap(keyset) {
|
||||
[].forEach.call(keyset.querySelectorAll("key"), function (key) {
|
||||
|
||||
function buildDevtoolsKeysetMap(keyset) {
|
||||
[].forEach.call(
|
||||
keyset.querySelectorAll("key"),
|
||||
function (key) {
|
||||
if (!key.getAttribute("key")) {
|
||||
return;
|
||||
}
|
||||
|
@ -57,69 +39,70 @@ function test()
|
|||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setupKeyBindingsTest()
|
||||
{
|
||||
for (let win of gDevToolsBrowser._trackedBrowserWindows) {
|
||||
buildDevtoolsKeysetMap(win.document.getElementById("devtoolsKeyset"));
|
||||
}
|
||||
|
||||
gDevTools.once("toolbox-ready", (e, toolbox) => {
|
||||
inspectorShouldBeOpenAndHighlighting(toolbox.getCurrentPanel(), toolbox);
|
||||
});
|
||||
|
||||
keysetMap.inspector.synthesizeKey();
|
||||
}
|
||||
|
||||
function inspectorShouldBeOpenAndHighlighting(aInspector, aToolbox)
|
||||
{
|
||||
is(aToolbox.currentToolId, "inspector", "Correct tool has been loaded");
|
||||
|
||||
aToolbox.once("picker-started", () => {
|
||||
ok(true, "picker-started event received, highlighter started");
|
||||
keysetMap.inspector.synthesizeKey();
|
||||
|
||||
aToolbox.once("picker-stopped", () => {
|
||||
ok(true, "picker-stopped event received, highlighter stopped");
|
||||
gDevTools.once("select-tool-command", () => {
|
||||
webconsoleShouldBeSelected(aToolbox);
|
||||
});
|
||||
keysetMap.webconsole.synthesizeKey();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function webconsoleShouldBeSelected(aToolbox)
|
||||
{
|
||||
is(aToolbox.currentToolId, "webconsole", "webconsole should be selected.");
|
||||
|
||||
gDevTools.once("select-tool-command", () => {
|
||||
jsdebuggerShouldBeSelected(aToolbox);
|
||||
});
|
||||
keysetMap.jsdebugger.synthesizeKey();
|
||||
}
|
||||
|
||||
function jsdebuggerShouldBeSelected(aToolbox)
|
||||
{
|
||||
is(aToolbox.currentToolId, "jsdebugger", "jsdebugger should be selected.");
|
||||
|
||||
gDevTools.once("select-tool-command", () => {
|
||||
netmonitorShouldBeSelected(aToolbox);
|
||||
});
|
||||
|
||||
keysetMap.netmonitor.synthesizeKey();
|
||||
}
|
||||
|
||||
function netmonitorShouldBeSelected(aToolbox, panel)
|
||||
{
|
||||
is(aToolbox.currentToolId, "netmonitor", "netmonitor should be selected.");
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
doc = node = inspector = keysetMap = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
function setupKeyBindingsTest() {
|
||||
for (let win of gDevToolsBrowser._trackedBrowserWindows) {
|
||||
buildDevtoolsKeysetMap(win.document.getElementById("devtoolsKeyset"));
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function () {
|
||||
// Use the new debugger frontend because the old one swallows the netmonitor shortcut:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1370442#c7
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["devtools.debugger.new-debugger-frontend", true]
|
||||
]});
|
||||
|
||||
await addTab(TEST_URL);
|
||||
await new Promise(done => waitForFocus(done));
|
||||
|
||||
setupKeyBindingsTest();
|
||||
|
||||
let onToolboxReady = gDevTools.once("toolbox-ready");
|
||||
keysetMap.inspector.synthesizeKey();
|
||||
let toolbox = await onToolboxReady;
|
||||
|
||||
await inspectorShouldBeOpenAndHighlighting();
|
||||
|
||||
let onSelectTool = gDevTools.once("select-tool-command");
|
||||
keysetMap.webconsole.synthesizeKey();
|
||||
await onSelectTool;
|
||||
await webconsoleShouldBeSelected();
|
||||
|
||||
onSelectTool = gDevTools.once("select-tool-command");
|
||||
keysetMap.jsdebugger.synthesizeKey();
|
||||
await onSelectTool;
|
||||
await jsdebuggerShouldBeSelected();
|
||||
|
||||
onSelectTool = gDevTools.once("select-tool-command");
|
||||
keysetMap.netmonitor.synthesizeKey();
|
||||
await onSelectTool;
|
||||
await netmonitorShouldBeSelected();
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
async function inspectorShouldBeOpenAndHighlighting() {
|
||||
is(toolbox.currentToolId, "inspector", "Correct tool has been loaded");
|
||||
|
||||
await toolbox.once("picker-started");
|
||||
|
||||
ok(true, "picker-started event received, highlighter started");
|
||||
keysetMap.inspector.synthesizeKey();
|
||||
|
||||
await toolbox.once("picker-stopped");
|
||||
ok(true, "picker-stopped event received, highlighter stopped");
|
||||
}
|
||||
|
||||
function webconsoleShouldBeSelected() {
|
||||
is(toolbox.currentToolId, "webconsole", "webconsole should be selected.");
|
||||
}
|
||||
|
||||
function jsdebuggerShouldBeSelected() {
|
||||
is(toolbox.currentToolId, "jsdebugger", "jsdebugger should be selected.");
|
||||
}
|
||||
|
||||
function netmonitorShouldBeSelected() {
|
||||
is(toolbox.currentToolId, "netmonitor", "netmonitor should be selected.");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const { TimelineFront } = require("devtools/shared/fronts/timeline");
|
||||
const { ACTIVITY_TYPE, EVENTS } = require("../constants");
|
||||
const FirefoxDataProvider = require("./firefox-data-provider");
|
||||
|
||||
// To be removed once FF60 is deprecated
|
||||
loader.lazyRequireGetter(this, "TimelineFront", "devtools/shared/fronts/timeline", true);
|
||||
|
||||
class FirefoxConnector {
|
||||
constructor() {
|
||||
// Public methods
|
||||
|
@ -18,6 +20,7 @@ class FirefoxConnector {
|
|||
this.navigate = this.navigate.bind(this);
|
||||
this.displayCachedEvents = this.displayCachedEvents.bind(this);
|
||||
this.onDocLoadingMarker = this.onDocLoadingMarker.bind(this);
|
||||
this.onDocEvent = this.onDocEvent.bind(this);
|
||||
this.sendHTTPRequest = this.sendHTTPRequest.bind(this);
|
||||
this.setPreferences = this.setPreferences.bind(this);
|
||||
this.triggerActivity = this.triggerActivity.bind(this);
|
||||
|
@ -44,7 +47,7 @@ class FirefoxConnector {
|
|||
actions: this.actions,
|
||||
});
|
||||
|
||||
this.addListeners();
|
||||
await this.addListeners();
|
||||
|
||||
// Listener for `will-navigate` event is (un)registered outside
|
||||
// of the `addListeners` and `removeListeners` methods since
|
||||
|
@ -54,64 +57,71 @@ class FirefoxConnector {
|
|||
this.tabTarget.on("will-navigate", this.willNavigate);
|
||||
this.tabTarget.on("navigate", this.navigate);
|
||||
|
||||
// Don't start up waiting for timeline markers if the server isn't
|
||||
// recent enough to emit the markers we're interested in.
|
||||
if (this.tabTarget.getTrait("documentLoadingMarkers")) {
|
||||
this.timelineFront = new TimelineFront(this.tabTarget.client, this.tabTarget.form);
|
||||
this.timelineFront.on("doc-loading", this.onDocLoadingMarker);
|
||||
await this.timelineFront.start({ withDocLoadingEvents: true });
|
||||
}
|
||||
|
||||
this.displayCachedEvents();
|
||||
}
|
||||
|
||||
async disconnect() {
|
||||
this.actions.batchReset();
|
||||
|
||||
this.removeListeners();
|
||||
await this.removeListeners();
|
||||
|
||||
if (this.tabTarget) {
|
||||
// Unregister `will-navigate` needs to be done before `this.timelineFront.destroy()`
|
||||
// since this.tabTarget might be nullified after timelineFront.destroy().
|
||||
this.tabTarget.off("will-navigate");
|
||||
// The timeline front wasn't initialized and started if the server wasn't
|
||||
// recent enough to emit the markers we were interested in.
|
||||
if (this.tabTarget.getTrait("documentLoadingMarkers") && this.timelineFront) {
|
||||
this.timelineFront.off("doc-loading", this.onDocLoadingMarker);
|
||||
await this.timelineFront.destroy();
|
||||
}
|
||||
this.tabTarget = null;
|
||||
}
|
||||
|
||||
this.webConsoleClient = null;
|
||||
this.timelineFront = null;
|
||||
this.dataProvider = null;
|
||||
this.panel = null;
|
||||
}
|
||||
|
||||
pause() {
|
||||
this.removeListeners();
|
||||
async pause() {
|
||||
await this.removeListeners();
|
||||
}
|
||||
|
||||
resume() {
|
||||
this.addListeners();
|
||||
async resume() {
|
||||
await this.addListeners();
|
||||
}
|
||||
|
||||
addListeners() {
|
||||
async addListeners() {
|
||||
this.tabTarget.on("close", this.disconnect);
|
||||
this.webConsoleClient.on("networkEvent",
|
||||
this.dataProvider.onNetworkEvent);
|
||||
this.webConsoleClient.on("networkEventUpdate",
|
||||
this.dataProvider.onNetworkEventUpdate);
|
||||
this.webConsoleClient.on("documentEvent", this.onDocEvent);
|
||||
|
||||
// With FF60+ console actor supports listening to document events like
|
||||
// DOMContentLoaded and load. We used to query Timeline actor, but it was too CPU
|
||||
// intensive.
|
||||
let { startedListeners } = await this.webConsoleClient.startListeners(
|
||||
["DocumentEvents"]);
|
||||
// Allows to know if we are on FF60 and support these events.
|
||||
let supportsDocEvents = startedListeners.includes("DocumentEvents");
|
||||
|
||||
// Don't start up waiting for timeline markers if the server isn't
|
||||
// recent enough (<FF45) to emit the markers we're interested in.
|
||||
if (!supportsDocEvents && !this.timelineFront &&
|
||||
this.tabTarget.getTrait("documentLoadingMarkers")) {
|
||||
this.timelineFront = new TimelineFront(this.tabTarget.client, this.tabTarget.form);
|
||||
this.timelineFront.on("doc-loading", this.onDocLoadingMarker);
|
||||
await this.timelineFront.start({ withDocLoadingEvents: true });
|
||||
}
|
||||
}
|
||||
|
||||
removeListeners() {
|
||||
async removeListeners() {
|
||||
if (this.tabTarget) {
|
||||
this.tabTarget.off("close");
|
||||
}
|
||||
if (this.timelineFront) {
|
||||
this.timelineFront.off("doc-loading", this.onDocLoadingMarker);
|
||||
await this.timelineFront.destroy();
|
||||
this.timelineFront = null;
|
||||
}
|
||||
if (this.webConsoleClient) {
|
||||
this.webConsoleClient.off("networkEvent");
|
||||
this.webConsoleClient.off("networkEventUpdate");
|
||||
this.webConsoleClient.off("docEvent");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,11 +186,32 @@ class FirefoxConnector {
|
|||
/**
|
||||
* The "DOMContentLoaded" and "Load" events sent by the timeline actor.
|
||||
*
|
||||
* To be removed once FF60 is deprecated.
|
||||
*
|
||||
* @param {object} marker
|
||||
*/
|
||||
onDocLoadingMarker(marker) {
|
||||
window.emit(EVENTS.TIMELINE_EVENT, marker);
|
||||
this.actions.addTimingMarker(marker);
|
||||
// Translate marker into event similar to newer "docEvent" event sent by the console
|
||||
// actor
|
||||
let event = {
|
||||
name: marker.name == "document::DOMContentLoaded" ?
|
||||
"dom-interactive" : "dom-complete",
|
||||
time: marker.unixTime / 1000
|
||||
};
|
||||
window.emit(EVENTS.TIMELINE_EVENT, event);
|
||||
this.actions.addTimingMarker(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* The "DOMContentLoaded" and "Load" events sent by the console actor.
|
||||
*
|
||||
* Only used by FF60+.
|
||||
*
|
||||
* @param {object} marker
|
||||
*/
|
||||
onDocEvent(type, event) {
|
||||
window.emit(EVENTS.TIMELINE_EVENT, event);
|
||||
this.actions.addTimingMarker(event);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class Connector {
|
|||
|
||||
// Connect/Disconnect API
|
||||
|
||||
connect(connection, actions, getState) {
|
||||
async connect(connection, actions, getState) {
|
||||
if (!connection || !connection.tab) {
|
||||
return;
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ class Connector {
|
|||
let { clientType } = connection.tab;
|
||||
switch (clientType) {
|
||||
case "chrome":
|
||||
this.connectChrome(connection, actions, getState);
|
||||
await this.connectChrome(connection, actions, getState);
|
||||
break;
|
||||
case "firefox":
|
||||
this.connectFirefox(connection, actions, getState);
|
||||
await this.connectFirefox(connection, actions, getState);
|
||||
break;
|
||||
default:
|
||||
throw Error(`Unknown client type - ${clientType}`);
|
||||
|
@ -54,20 +54,20 @@ class Connector {
|
|||
|
||||
connectChrome(connection, actions, getState) {
|
||||
this.connector = require("./chrome-connector");
|
||||
this.connector.connect(connection, actions, getState);
|
||||
return this.connector.connect(connection, actions, getState);
|
||||
}
|
||||
|
||||
connectFirefox(connection, actions, getState) {
|
||||
this.connector = require("./firefox-connector");
|
||||
this.connector.connect(connection, actions, getState);
|
||||
return this.connector.connect(connection, actions, getState);
|
||||
}
|
||||
|
||||
pause() {
|
||||
this.connector.pause();
|
||||
return this.connector.pause();
|
||||
}
|
||||
|
||||
resume() {
|
||||
this.connector.resume();
|
||||
return this.connector.resume();
|
||||
}
|
||||
|
||||
// Public API
|
||||
|
|
|
@ -20,15 +20,15 @@ function TimingMarkers() {
|
|||
function addTimingMarker(state, action) {
|
||||
state = { ...state };
|
||||
|
||||
if (action.marker.name === "document::DOMContentLoaded" &&
|
||||
if (action.marker.name === "dom-interactive" &&
|
||||
state.firstDocumentDOMContentLoadedTimestamp === -1) {
|
||||
state.firstDocumentDOMContentLoadedTimestamp = action.marker.unixTime / 1000;
|
||||
state.firstDocumentDOMContentLoadedTimestamp = action.marker.time;
|
||||
return state;
|
||||
}
|
||||
|
||||
if (action.marker.name === "document::Load" &&
|
||||
if (action.marker.name === "dom-complete" &&
|
||||
state.firstDocumentLoadTimestamp === -1) {
|
||||
state.firstDocumentLoadTimestamp = action.marker.unixTime / 1000;
|
||||
state.firstDocumentLoadTimestamp = action.marker.time;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ add_task(function* () {
|
|||
|
||||
ok(true, "Reloading finished");
|
||||
|
||||
is(markers[0].name, "document::DOMContentLoaded",
|
||||
is(markers[0].name, "dom-interactive",
|
||||
"The first received marker is correct.");
|
||||
is(markers[1].name, "document::Load",
|
||||
is(markers[1].name, "dom-complete",
|
||||
"The second received marker is correct.");
|
||||
|
||||
return teardown(monitor);
|
||||
|
|
|
@ -29,7 +29,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
|||
|
||||
var { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||
var { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
var { LoadContextInfo } = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
||||
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
|
||||
var { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
@ -254,7 +253,7 @@ AppCacheUtils.prototype = {
|
|||
|
||||
let entries = [];
|
||||
|
||||
let appCacheStorage = Services.cache2.appCacheStorage(LoadContextInfo.default, null);
|
||||
let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
|
||||
appCacheStorage.asyncVisitStorage({
|
||||
onCacheStorageInfo: function () {},
|
||||
|
||||
|
@ -303,7 +302,7 @@ AppCacheUtils.prototype = {
|
|||
throw new Error(l10n.GetStringFromName("cacheDisabled"));
|
||||
}
|
||||
|
||||
let appCacheStorage = Services.cache2.appCacheStorage(LoadContextInfo.default, null);
|
||||
let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
|
||||
appCacheStorage.asyncEvictStorage({
|
||||
onCacheEntryDoomed: function (result) {}
|
||||
});
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
const TEST_URL = "http://" + TEST_HOST + "/browser/devtools/client/" +
|
||||
"styleeditor/test/test_private.html";
|
||||
const {LoadContextInfo} =
|
||||
Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
||||
const cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
||||
.getService(Ci.nsICacheStorageService);
|
||||
|
||||
|
@ -64,7 +62,7 @@ function checkDiskCacheFor(host) {
|
|||
};
|
||||
function Visitor() {}
|
||||
|
||||
let storage = cache.diskCacheStorage(LoadContextInfo.default, false);
|
||||
let storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
storage.asyncVisitStorage(new Visitor(),
|
||||
/* Do walk entries */
|
||||
true);
|
||||
|
|
|
@ -40,6 +40,7 @@ if (isWorker) {
|
|||
loader.lazyRequireGetter(this, "ConsoleServiceListener", "devtools/server/actors/webconsole/listeners", true);
|
||||
loader.lazyRequireGetter(this, "ConsoleReflowListener", "devtools/server/actors/webconsole/listeners", true);
|
||||
loader.lazyRequireGetter(this, "ContentProcessListener", "devtools/server/actors/webconsole/listeners", true);
|
||||
loader.lazyRequireGetter(this, "DocumentEventsListener", "devtools/server/actors/webconsole/listeners", true);
|
||||
}
|
||||
|
||||
function isObject(value) {
|
||||
|
@ -694,6 +695,16 @@ WebConsoleActor.prototype =
|
|||
}
|
||||
startedListeners.push(listener);
|
||||
break;
|
||||
case "DocumentEvents":
|
||||
// Workers don't support this message type
|
||||
if (isWorker) {
|
||||
break;
|
||||
}
|
||||
if (!this.documentEventsListener) {
|
||||
this.documentEventsListener = new DocumentEventsListener(this);
|
||||
}
|
||||
startedListeners.push(listener);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,6 +797,13 @@ WebConsoleActor.prototype =
|
|||
}
|
||||
stoppedListeners.push(listener);
|
||||
break;
|
||||
case "DocumentEvents":
|
||||
if (this.documentEventsListener) {
|
||||
this.documentEventsListener.destroy();
|
||||
this.documentEventsListener = null;
|
||||
}
|
||||
stoppedListeners.push(listener);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ XPCOMUtils.defineLazyServiceGetter(this,
|
|||
"swm",
|
||||
"@mozilla.org/serviceworkers/manager;1",
|
||||
"nsIServiceWorkerManager");
|
||||
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
|
||||
|
||||
// Process script used to forward console calls from content processes to parent process
|
||||
const CONTENT_PROCESS_SCRIPT = "resource://devtools/server/actors/webconsole/content-process-forward.js";
|
||||
|
@ -490,3 +491,83 @@ ContentProcessListener.prototype = {
|
|||
this.listener = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Forward `DOMContentLoaded` and `load` events with precise timing
|
||||
* of when events happened according to window.performance numbers.
|
||||
*
|
||||
* @constructor
|
||||
* @param object console
|
||||
* The web console actor.
|
||||
*/
|
||||
function DocumentEventsListener(console) {
|
||||
this.console = console;
|
||||
|
||||
this.onWindowReady = this.onWindowReady.bind(this);
|
||||
this.onContentLoaded = this.onContentLoaded.bind(this);
|
||||
this.onLoad = this.onLoad.bind(this);
|
||||
this.listen();
|
||||
}
|
||||
|
||||
exports.DocumentEventsListener = DocumentEventsListener;
|
||||
|
||||
DocumentEventsListener.prototype = {
|
||||
listen() {
|
||||
EventEmitter.on(this.console.parentActor, "window-ready", this.onWindowReady);
|
||||
this.onWindowReady({ window: this.console.window, isTopLevel: true });
|
||||
},
|
||||
|
||||
onWindowReady({ window, isTopLevel }) {
|
||||
// Ignore iframes
|
||||
if (!isTopLevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
let { readyState } = window.document;
|
||||
if (readyState != "interactive" && readyState != "complete") {
|
||||
window.addEventListener("DOMContentLoaded", this.onContentLoaded, { once: true });
|
||||
} else {
|
||||
this.onContentLoaded({ target: window.document });
|
||||
}
|
||||
if (readyState != "complete") {
|
||||
window.addEventListener("load", this.onLoad, { once: true });
|
||||
} else {
|
||||
this.onLoad({ target: window.document });
|
||||
}
|
||||
},
|
||||
|
||||
onContentLoaded(event) {
|
||||
let window = event.target.defaultView;
|
||||
let packet = {
|
||||
from: this.console.actorID,
|
||||
type: "documentEvent",
|
||||
name: "dom-interactive",
|
||||
// milliseconds since the UNIX epoch, when the parser finished its work
|
||||
// on the main document, that is when its Document.readyState changes to
|
||||
// 'interactive' and the corresponding readystatechange event is thrown
|
||||
time: window.performance.timing.domInteractive
|
||||
};
|
||||
this.console.conn.send(packet);
|
||||
},
|
||||
|
||||
onLoad(event) {
|
||||
let window = event.target.defaultView;
|
||||
let packet = {
|
||||
from: this.console.actorID,
|
||||
type: "documentEvent",
|
||||
name: "dom-complete",
|
||||
// milliseconds since the UNIX epoch, when the parser finished its work
|
||||
// on the main document, that is when its Document.readyState changes to
|
||||
// 'complete' and the corresponding readystatechange event is thrown
|
||||
time: window.performance.timing.domComplete
|
||||
};
|
||||
this.console.conn.send(packet);
|
||||
},
|
||||
|
||||
destroy() {
|
||||
EventEmitter.off(this.console.parentActor, "window-ready", this.onWindowReady);
|
||||
|
||||
this.listener = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -107,4 +107,3 @@ skip-if = !e10s # test is designed to work on e10s only
|
|||
[test_webextension-addon-debugging-reload.html]
|
||||
skip-if = !e10s # test is designed to work on e10s only
|
||||
[test_websocket-server.html]
|
||||
skip-if = os == 'mac' # bug 1294873 intermittent leaks
|
||||
|
|
|
@ -24,11 +24,14 @@ window.onload = function () {
|
|||
// Create a TCP server on auto-assigned port
|
||||
let server = new ServerSocket(-1, true, -1);
|
||||
ok(server, `Launched WebSocket server on port ${server.port}`);
|
||||
|
||||
let input, output;
|
||||
|
||||
server.asyncListen({
|
||||
onSocketAccepted: Task.async(function* (socket, transport) {
|
||||
info("Accepted incoming connection");
|
||||
let input = transport.openInputStream(0, 0, 0);
|
||||
let output = transport.openOutputStream(0, 0, 0);
|
||||
input = transport.openInputStream(0, 0, 0);
|
||||
output = transport.openOutputStream(0, 0, 0);
|
||||
|
||||
// Perform the WebSocket handshake
|
||||
let webSocket = yield WebSocketServer.accept(transport, input, output);
|
||||
|
@ -77,6 +80,10 @@ window.onload = function () {
|
|||
// Close the connection
|
||||
client.close();
|
||||
yield closed;
|
||||
|
||||
// Prevent leaking the streams by closing them before test ends
|
||||
input.close();
|
||||
output.close();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -27,6 +27,7 @@ const UnsolicitedNotifications = {
|
|||
"logMessage": "logMessage",
|
||||
"networkEvent": "networkEvent",
|
||||
"networkEventUpdate": "networkEventUpdate",
|
||||
"documentEvent": "documentEvent",
|
||||
"newGlobal": "newGlobal",
|
||||
"newScript": "newScript",
|
||||
"tabDetached": "tabDetached",
|
||||
|
|
|
@ -6704,12 +6704,68 @@ exports.CSS_PROPERTIES = {
|
|||
11
|
||||
],
|
||||
"values": [
|
||||
"arabic-indic",
|
||||
"armenian",
|
||||
"bengali",
|
||||
"cambodian",
|
||||
"circle",
|
||||
"cjk-decimal",
|
||||
"cjk-earthly-branch",
|
||||
"cjk-heavenly-stem",
|
||||
"cjk-ideographic",
|
||||
"decimal",
|
||||
"decimal-leading-zero",
|
||||
"devanagari",
|
||||
"disc",
|
||||
"disclosure-closed",
|
||||
"disclosure-open",
|
||||
"ethiopic-numeric",
|
||||
"georgian",
|
||||
"gujarati",
|
||||
"gurmukhi",
|
||||
"hebrew",
|
||||
"hiragana",
|
||||
"hiragana-iroha",
|
||||
"inherit",
|
||||
"initial",
|
||||
"inside",
|
||||
"japanese-formal",
|
||||
"japanese-informal",
|
||||
"kannada",
|
||||
"katakana",
|
||||
"katakana-iroha",
|
||||
"khmer",
|
||||
"korean-hangul-formal",
|
||||
"korean-hanja-formal",
|
||||
"korean-hanja-informal",
|
||||
"lao",
|
||||
"lower-alpha",
|
||||
"lower-armenian",
|
||||
"lower-greek",
|
||||
"lower-latin",
|
||||
"lower-roman",
|
||||
"malayalam",
|
||||
"mongolian",
|
||||
"myanmar",
|
||||
"none",
|
||||
"oriya",
|
||||
"outside",
|
||||
"persian",
|
||||
"simp-chinese-formal",
|
||||
"simp-chinese-informal",
|
||||
"square",
|
||||
"symbols",
|
||||
"tamil",
|
||||
"telugu",
|
||||
"thai",
|
||||
"tibetan",
|
||||
"trad-chinese-formal",
|
||||
"trad-chinese-informal",
|
||||
"unset",
|
||||
"upper-alpha",
|
||||
"upper-armenian",
|
||||
"upper-latin",
|
||||
"upper-roman",
|
||||
"url"
|
||||
]
|
||||
},
|
||||
|
@ -6750,9 +6806,66 @@ exports.CSS_PROPERTIES = {
|
|||
],
|
||||
"supports": [],
|
||||
"values": [
|
||||
"arabic-indic",
|
||||
"armenian",
|
||||
"bengali",
|
||||
"cambodian",
|
||||
"circle",
|
||||
"cjk-decimal",
|
||||
"cjk-earthly-branch",
|
||||
"cjk-heavenly-stem",
|
||||
"cjk-ideographic",
|
||||
"decimal",
|
||||
"decimal-leading-zero",
|
||||
"devanagari",
|
||||
"disc",
|
||||
"disclosure-closed",
|
||||
"disclosure-open",
|
||||
"ethiopic-numeric",
|
||||
"georgian",
|
||||
"gujarati",
|
||||
"gurmukhi",
|
||||
"hebrew",
|
||||
"hiragana",
|
||||
"hiragana-iroha",
|
||||
"inherit",
|
||||
"initial",
|
||||
"unset"
|
||||
"japanese-formal",
|
||||
"japanese-informal",
|
||||
"kannada",
|
||||
"katakana",
|
||||
"katakana-iroha",
|
||||
"khmer",
|
||||
"korean-hangul-formal",
|
||||
"korean-hanja-formal",
|
||||
"korean-hanja-informal",
|
||||
"lao",
|
||||
"lower-alpha",
|
||||
"lower-armenian",
|
||||
"lower-greek",
|
||||
"lower-latin",
|
||||
"lower-roman",
|
||||
"malayalam",
|
||||
"mongolian",
|
||||
"myanmar",
|
||||
"none",
|
||||
"oriya",
|
||||
"persian",
|
||||
"simp-chinese-formal",
|
||||
"simp-chinese-informal",
|
||||
"square",
|
||||
"symbols",
|
||||
"tamil",
|
||||
"telugu",
|
||||
"thai",
|
||||
"tibetan",
|
||||
"trad-chinese-formal",
|
||||
"trad-chinese-informal",
|
||||
"unset",
|
||||
"upper-alpha",
|
||||
"upper-armenian",
|
||||
"upper-latin",
|
||||
"upper-roman"
|
||||
]
|
||||
},
|
||||
"margin": {
|
||||
|
|
|
@ -33,11 +33,13 @@ function WebConsoleClient(debuggerClient, response) {
|
|||
this.onNetworkEvent = this._onNetworkEvent.bind(this);
|
||||
this.onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this);
|
||||
this.onInspectObject = this._onInspectObject.bind(this);
|
||||
this.onDocEvent = this._onDocEvent.bind(this);
|
||||
|
||||
this._client.addListener("evaluationResult", this.onEvaluationResult);
|
||||
this._client.addListener("networkEvent", this.onNetworkEvent);
|
||||
this._client.addListener("networkEventUpdate", this.onNetworkEventUpdate);
|
||||
this._client.addListener("inspectObject", this.onInspectObject);
|
||||
this._client.addListener("documentEvent", this.onDocEvent);
|
||||
EventEmitter.decorate(this);
|
||||
}
|
||||
|
||||
|
@ -187,6 +189,20 @@ WebConsoleClient.prototype = {
|
|||
this.emit("inspectObject", packet);
|
||||
},
|
||||
|
||||
/**
|
||||
* The "docEvent" message type handler. We just re-emit it so that
|
||||
* the tools can listen for them on the console client.
|
||||
*
|
||||
* @private
|
||||
* @param string type
|
||||
* Message type.
|
||||
* @param object packet
|
||||
* The message received from the server.
|
||||
*/
|
||||
_onDocEvent: function (type, packet) {
|
||||
this.emit("documentEvent", packet);
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve the cached messages from the server.
|
||||
*
|
||||
|
@ -676,6 +692,7 @@ WebConsoleClient.prototype = {
|
|||
this._client.removeListener("networkEventUpdate",
|
||||
this.onNetworkEventUpdate);
|
||||
this._client.removeListener("inspectObject", this.onInspectObject);
|
||||
this._client.removeListener("documentEvent", this.onDocEvent);
|
||||
this.stopListeners(null, onResponse);
|
||||
this._longStrings = null;
|
||||
this._client = null;
|
||||
|
|
|
@ -1513,11 +1513,13 @@ Animation::IsRunningOnCompositor() const
|
|||
mEffect->AsKeyframeEffect()->IsRunningOnCompositor();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template
|
||||
void
|
||||
Animation::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
|
||||
RefPtr<AnimValuesStyleRule>& aAnimationRule,
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoStyleContext.h"
|
||||
#endif
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/RestyleManagerInlines.h"
|
||||
|
@ -34,8 +36,10 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIPresShellInlines.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
|
||||
#include "nsRuleProcessorData.h" // For ElementRuleProcessorData etc.
|
||||
#endif
|
||||
#include "nsStyleContextInlines.h"
|
||||
#include "nsTArray.h"
|
||||
#include "PendingAnimationTracker.h"
|
||||
|
@ -383,6 +387,7 @@ EffectCompositor::UpdateEffectProperties(StyleType* aStyleType,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
|
@ -456,6 +461,7 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
|||
|
||||
return effectSet->AnimationRule(aCascadeLevel);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
class EffectCompositeOrderComparator {
|
||||
|
@ -570,6 +576,7 @@ EffectCompositor::HasThrottledStyleUpdates() const
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
|
||||
{
|
||||
|
@ -621,6 +628,7 @@ EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
|
|||
// Note: mElement pointers in elementsToRestyle might now dangle
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ bool
|
||||
EffectCompositor::HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
|
@ -713,6 +721,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* static */ void
|
||||
EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
|
@ -752,6 +761,7 @@ EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
|
|||
MOZ_ASSERT(effects == EffectSet::GetEffectSet(aElement, aPseudoType),
|
||||
"EffectSet should not change while composing style");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ nsCSSPropertyIDSet
|
||||
EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
||||
|
@ -768,6 +778,7 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
|
||||
Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
|
||||
if (aBackendType == StyleBackendType::Gecko && !aStyleContext) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (elementToRestyle) {
|
||||
nsIFrame* frame = elementToRestyle->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
|
@ -778,6 +789,9 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
if (!aStyleContext) {
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else if (aBackendType == StyleBackendType::Servo && !elementToRestyle) {
|
||||
return result;
|
||||
}
|
||||
|
@ -813,9 +827,13 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
&result);
|
||||
break;
|
||||
case StyleBackendType::Gecko:
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsRuleNode::ComputePropertiesOverridingAnimation(propertiesToTrack,
|
||||
aStyleContext->AsGecko(),
|
||||
result);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1191,6 +1209,7 @@ EffectCompositor::PreTraverse(dom::Element* aElement,
|
|||
return found;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// ---------------------------------------------------------
|
||||
//
|
||||
// Nested class: AnimationStyleRuleProcessor
|
||||
|
@ -1305,6 +1324,7 @@ EffectCompositor::UpdateEffectProperties(
|
|||
GeckoStyleContext* aStyleContext,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
#include "nsCSSPropertyID.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsCSSPropertyIDSet;
|
||||
|
@ -48,11 +50,13 @@ public:
|
|||
explicit EffectCompositor(nsPresContext* aPresContext)
|
||||
: mPresContext(aPresContext)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
for (size_t i = 0; i < kCascadeLevelCount; i++) {
|
||||
CascadeLevel cascadeLevel = CascadeLevel(i);
|
||||
mRuleProcessors[cascadeLevel] =
|
||||
new AnimationStyleRuleProcessor(this, cascadeLevel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EffectCompositor)
|
||||
|
@ -126,6 +130,7 @@ public:
|
|||
dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Updates the animation rule stored on the EffectSet for the
|
||||
// specified (pseudo-)element for cascade level |aLevel|.
|
||||
// If the animation rule is not marked as needing an update,
|
||||
|
@ -154,6 +159,7 @@ public:
|
|||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel,
|
||||
nsStyleContext* aStyleContext);
|
||||
#endif
|
||||
|
||||
// Get animation rule for stylo. This is an equivalent of GetAnimationRule
|
||||
// and will be called from servo side.
|
||||
|
@ -169,6 +175,7 @@ public:
|
|||
bool HasPendingStyleUpdates() const;
|
||||
bool HasThrottledStyleUpdates() const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Tell the restyle tracker about all the animated styles that have
|
||||
// pending updates so that it can update the animation rule for these
|
||||
// elements.
|
||||
|
@ -178,6 +185,7 @@ public:
|
|||
{
|
||||
return mRuleProcessors[aCascadeLevel];
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
nsCSSPropertyID aProperty);
|
||||
|
@ -254,11 +262,13 @@ public:
|
|||
private:
|
||||
~EffectCompositor() = default;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Rebuilds the animation rule corresponding to |aCascadeLevel| on the
|
||||
// EffectSet associated with the specified (pseudo-)element.
|
||||
static void ComposeAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel);
|
||||
#endif
|
||||
|
||||
// Get the properties in |aEffectSet| that we are able to animate on the
|
||||
// compositor but which are also specified at a higher level in the cascade
|
||||
|
@ -312,6 +322,7 @@ private:
|
|||
|
||||
bool mIsInPreTraverse = false;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
class AnimationStyleRuleProcessor final : public nsIStyleRuleProcessor
|
||||
{
|
||||
public:
|
||||
|
@ -356,6 +367,7 @@ private:
|
|||
EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
|
||||
OwningNonNull<AnimationStyleRuleProcessor>>
|
||||
mRuleProcessors;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#ifndef mozilla_EffectSet_h
|
||||
#define mozilla_EffectSet_h
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/AnimValuesStyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
|
@ -170,11 +172,13 @@ public:
|
|||
|
||||
size_t Count() const { return mEffects.Count(); }
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<AnimValuesStyleRule>&
|
||||
AnimationRule(EffectCompositor::CascadeLevel aCascadeLevel)
|
||||
{
|
||||
return mAnimationRule[aCascadeLevel];
|
||||
}
|
||||
#endif
|
||||
|
||||
const TimeStamp& LastTransformSyncTime() const
|
||||
{
|
||||
|
@ -212,6 +216,7 @@ private:
|
|||
|
||||
OwningEffectSet mEffects;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// These style rules contain the style data for currently animating
|
||||
// values. They only match when styling with animation. When we
|
||||
// style without animation, we need to not use them so that we can
|
||||
|
@ -221,6 +226,7 @@ private:
|
|||
EffectCompositor::CascadeLevel(
|
||||
EffectCompositor::kCascadeLevelCount),
|
||||
RefPtr<AnimValuesStyleRule>> mAnimationRule;
|
||||
#endif
|
||||
|
||||
// Refresh driver timestamp from the moment when transform animations in this
|
||||
// effect set were last updated and sent to the compositor. This is used for
|
||||
|
|
|
@ -12,12 +12,16 @@
|
|||
// For UnrestrictedDoubleOrKeyframeAnimationOptions;
|
||||
#include "mozilla/dom/CSSPseudoElement.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/AnimValuesStyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/FloatingPoint.h" // For IsFinite
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoStyleContext.h"
|
||||
#endif
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
|
@ -194,24 +198,31 @@ KeyframeEffectReadOnly::SetKeyframes(JSContext* aContext,
|
|||
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
if (auto gecko = styleContext->GetAsGecko()) {
|
||||
if (styleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto gecko = styleContext->AsGecko();
|
||||
SetKeyframes(Move(keyframes), gecko);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
SetKeyframes(Move(keyframes), styleContext->AsServo());
|
||||
}
|
||||
} else {
|
||||
// SetKeyframes has the same behavior for null StyleType* for
|
||||
// both backends, just pick one and use it.
|
||||
SetKeyframes(Move(keyframes), (GeckoStyleContext*) nullptr);
|
||||
SetKeyframes(Move(keyframes), (ServoStyleContext*) nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
GeckoStyleContext* aStyleContext)
|
||||
{
|
||||
DoSetKeyframes(Move(aKeyframes), Move(aStyleContext));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(
|
||||
|
@ -226,10 +237,12 @@ void
|
|||
KeyframeEffectReadOnly::DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
StyleType* aStyle)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static_assert(IsSame<StyleType, GeckoStyleContext>::value ||
|
||||
IsSame<StyleType, const ServoStyleContext>::value,
|
||||
"StyleType should be GeckoStyleContext* or "
|
||||
"const ServoStyleContext*");
|
||||
#endif
|
||||
|
||||
if (KeyframesEqualIgnoringComputedOffsets(aKeyframes, mKeyframes)) {
|
||||
return;
|
||||
|
@ -313,9 +326,14 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
|||
{
|
||||
MOZ_ASSERT(aStyleContext);
|
||||
|
||||
if (auto gecko = aStyleContext->GetAsGecko()) {
|
||||
if (aStyleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto gecko = aStyleContext->AsGecko();
|
||||
DoUpdateProperties(Move(gecko));
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
UpdateProperties(aStyleContext->AsServo());
|
||||
|
@ -377,6 +395,7 @@ KeyframeEffectReadOnly::DoUpdateProperties(StyleType* aStyle)
|
|||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* static */ StyleAnimationValue
|
||||
KeyframeEffectReadOnly::CompositeValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
|
@ -509,6 +528,7 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
|
|||
|
||||
mBaseStyleValues.Put(aProperty, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::EnsureBaseStyles(
|
||||
|
@ -590,6 +610,7 @@ KeyframeEffectReadOnly::WillComposeStyle()
|
|||
mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyleRule(
|
||||
RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||
|
@ -669,6 +690,7 @@ KeyframeEffectReadOnly::ComposeStyleRule(
|
|||
aStyleRule->AddValue(aProperty.mProperty, Move(toValue));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyleRule(
|
||||
|
@ -947,10 +969,12 @@ template<typename StyleType>
|
|||
nsTArray<AnimationProperty>
|
||||
KeyframeEffectReadOnly::BuildProperties(StyleType* aStyle)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static_assert(IsSame<StyleType, GeckoStyleContext>::value ||
|
||||
IsSame<StyleType, const ServoStyleContext>::value,
|
||||
"StyleType should be GeckoStyleContext* or "
|
||||
"const ServoStyleContext*");
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(aStyle);
|
||||
|
||||
|
@ -1340,33 +1364,39 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
|
|||
&stringValue);
|
||||
}
|
||||
}
|
||||
} else if (nsCSSProps::IsShorthand(propertyValue.mProperty)) {
|
||||
// nsCSSValue::AppendToString does not accept shorthands properties but
|
||||
// works with token stream values if we pass eCSSProperty_UNKNOWN as
|
||||
// the property.
|
||||
propertyValue.mValue.AppendToString(
|
||||
eCSSProperty_UNKNOWN, stringValue);
|
||||
} else {
|
||||
nsCSSValue cssValue = propertyValue.mValue;
|
||||
if (cssValue.GetUnit() == eCSSUnit_Null) {
|
||||
// We use an uninitialized nsCSSValue to represent the
|
||||
// "neutral value". We currently only do this for keyframes generated
|
||||
// from CSS animations with missing 0%/100% keyframes. Furthermore,
|
||||
// currently (at least until bug 1339334) keyframes generated from
|
||||
// CSS animations only contain longhand properties so we only need to
|
||||
// handle null nsCSSValues for longhand properties.
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::UncomputeValue(
|
||||
propertyValue.mProperty,
|
||||
Move(BaseStyle(propertyValue.mProperty).mGecko),
|
||||
cssValue);
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (nsCSSProps::IsShorthand(propertyValue.mProperty)) {
|
||||
// nsCSSValue::AppendToString does not accept shorthands properties but
|
||||
// works with token stream values if we pass eCSSProperty_UNKNOWN as
|
||||
// the property.
|
||||
propertyValue.mValue.AppendToString(
|
||||
eCSSProperty_UNKNOWN, stringValue);
|
||||
} else {
|
||||
nsCSSValue cssValue = propertyValue.mValue;
|
||||
if (cssValue.GetUnit() == eCSSUnit_Null) {
|
||||
// We use an uninitialized nsCSSValue to represent the
|
||||
// "neutral value". We currently only do this for keyframes generated
|
||||
// from CSS animations with missing 0%/100% keyframes. Furthermore,
|
||||
// currently (at least until bug 1339334) keyframes generated from
|
||||
// CSS animations only contain longhand properties so we only need to
|
||||
// handle null nsCSSValues for longhand properties.
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::UncomputeValue(
|
||||
propertyValue.mProperty,
|
||||
Move(BaseStyle(propertyValue.mProperty).mGecko),
|
||||
cssValue);
|
||||
|
||||
MOZ_ASSERT(uncomputeResult,
|
||||
"Unable to get specified value from computed value");
|
||||
MOZ_ASSERT(cssValue.GetUnit() != eCSSUnit_Null,
|
||||
"Got null computed value");
|
||||
MOZ_ASSERT(uncomputeResult,
|
||||
"Unable to get specified value from computed value");
|
||||
MOZ_ASSERT(cssValue.GetUnit() != eCSSUnit_Null,
|
||||
"Got null computed value");
|
||||
}
|
||||
cssValue.AppendToString(propertyValue.mProperty, stringValue);
|
||||
}
|
||||
cssValue.AppendToString(propertyValue.mProperty, stringValue);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* name = nsCSSProps::PropertyIDLName(propertyValue.mProperty);
|
||||
|
@ -1719,6 +1749,7 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
|
@ -1747,6 +1778,7 @@ KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
|||
|
||||
return styleContext.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
|
@ -1987,11 +2019,13 @@ KeyframeEffectReadOnly::UpdateEffectSet(EffectSet* aEffectSet) const
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
|
||||
RefPtr<AnimValuesStyleRule>& aAnimationRule,
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
|
|
@ -165,8 +165,10 @@ public:
|
|||
void SetAnimation(Animation* aAnimation) override;
|
||||
void SetKeyframes(JSContext* aContext, JS::Handle<JSObject*> aKeyframes,
|
||||
ErrorResult& aRv);
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
GeckoStyleContext* aStyleContext);
|
||||
#endif
|
||||
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
const ServoStyleContext* aComputedValues);
|
||||
|
||||
|
@ -212,6 +214,7 @@ public:
|
|||
void ComposeStyle(ComposeAnimationResult&& aRestultContainer,
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Composite |aValueToComposite| on |aUnderlyingValue| with
|
||||
// |aCompositeOperation|.
|
||||
// Returns |aValueToComposite| if |aCompositeOperation| is Replace.
|
||||
|
@ -220,6 +223,7 @@ public:
|
|||
const StyleAnimationValue& aValueToComposite,
|
||||
const StyleAnimationValue& aUnderlyingValue,
|
||||
CompositeOperation aCompositeOperation);
|
||||
#endif
|
||||
|
||||
// Returns true if at least one property is being animated on compositor.
|
||||
bool IsRunningOnCompositor() const;
|
||||
|
@ -279,7 +283,11 @@ public:
|
|||
// then assign the raw pointer to a RefPtr.
|
||||
result.mServo = mBaseStyleValuesForServo.GetWeak(aProperty, &hasProperty);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
hasProperty = mBaseStyleValues.Get(aProperty, &result.mGecko);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
MOZ_ASSERT(hasProperty || result.IsNull());
|
||||
return result;
|
||||
|
@ -347,6 +355,7 @@ protected:
|
|||
// target and its effectSet.
|
||||
void MarkCascadeNeedsUpdate();
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Composites |aValueToComposite| using |aCompositeOperation| onto the value
|
||||
// for |aProperty| in |aAnimationRule|, or, if there is no suitable value in
|
||||
// |aAnimationRule|, uses the base value for the property recorded on the
|
||||
|
@ -365,9 +374,11 @@ protected:
|
|||
// Ensure the base styles is available for any properties in |aProperties|.
|
||||
void EnsureBaseStyles(GeckoStyleContext* aStyleContext,
|
||||
const nsTArray<AnimationProperty>& aProperties);
|
||||
#endif
|
||||
void EnsureBaseStyles(const ServoStyleContext* aComputedValues,
|
||||
const nsTArray<AnimationProperty>& aProperties);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// If no base style is already stored for |aProperty|, resolves the base style
|
||||
// for |aProperty| using |aStyleContext| and stores it in mBaseStyleValues.
|
||||
// If |aCachedBaseStyleContext| is non-null, it will be used, otherwise the
|
||||
|
@ -376,6 +387,7 @@ protected:
|
|||
void EnsureBaseStyle(nsCSSPropertyID aProperty,
|
||||
GeckoStyleContext* aStyleContext,
|
||||
RefPtr<GeckoStyleContext>& aCachedBaseStyleContext);
|
||||
#endif
|
||||
// Stylo version of the above function that also first checks for an additive
|
||||
// value in |aProperty|'s list of segments.
|
||||
void EnsureBaseStyle(const AnimationProperty& aProperty,
|
||||
|
@ -410,7 +422,9 @@ protected:
|
|||
// The non-animated values for properties in this effect that contain at
|
||||
// least one animation value that is composited with the underlying value
|
||||
// (i.e. it uses the additive or accumulate composite mode).
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mBaseStyleValues;
|
||||
#endif
|
||||
nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>
|
||||
mBaseStyleValuesForServo;
|
||||
|
||||
|
@ -428,20 +442,24 @@ private:
|
|||
template<typename StyleType>
|
||||
void DoUpdateProperties(StyleType* aStyle);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void ComposeStyleRule(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||
const AnimationProperty& aProperty,
|
||||
const AnimationPropertySegment& aSegment,
|
||||
const ComputedTiming& aComputedTiming);
|
||||
#endif
|
||||
|
||||
void ComposeStyleRule(RawServoAnimationValueMap& aAnimationValues,
|
||||
const AnimationProperty& aProperty,
|
||||
const AnimationPropertySegment& aSegment,
|
||||
const ComputedTiming& aComputedTiming);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationValue& aValue,
|
||||
GeckoStyleContext* aBaseStyleContext);
|
||||
#endif
|
||||
|
||||
already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
|
|
|
@ -364,14 +364,18 @@ HasValidOffsets(const nsTArray<Keyframe>& aKeyframes);
|
|||
static void
|
||||
MarkAsComputeValuesFailureKey(PropertyValuePair& aPair);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
IsComputeValuesFailureKey(const PropertyValuePair& aPair);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
GeckoStyleContext* aStyleContext);
|
||||
#endif
|
||||
|
||||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
|
@ -897,6 +901,7 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
if (!nsCSSProps::IsShorthand(aProperty)) {
|
||||
aParser.ParseLonghandProperty(aProperty,
|
||||
|
@ -936,6 +941,9 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
|||
|
||||
result.emplace(aProperty, Move(value));
|
||||
return result;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -980,6 +988,7 @@ MarkAsComputeValuesFailureKey(PropertyValuePair& aPair)
|
|||
aPair.mSimulateComputeValuesFailure = true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Returns true if |aPair| is a property-value pair on which we have
|
||||
* previously called MarkAsComputeValuesFailureKey (and hence we should
|
||||
|
@ -996,7 +1005,9 @@ IsComputeValuesFailureKey(const PropertyValuePair& aPair)
|
|||
aPair.mSimulateComputeValuesFailure;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Calculate the StyleAnimationValues of properties of each keyframe.
|
||||
* This involves expanding shorthand properties into longhand properties,
|
||||
|
@ -1083,6 +1094,7 @@ GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
|||
MOZ_ASSERT(result.Length() == aKeyframes.Length(), "Array length mismatch");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The variation of the above function. This is for Servo backend.
|
||||
|
@ -1632,6 +1644,7 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
|
|||
for (const PropertyValuePair& pair : frame.mPropertyValues) {
|
||||
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
||||
if (styleBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValueTokenStream* tokenStream =
|
||||
pair.mValue.GetTokenStreamValue();
|
||||
nsCSSParser parser(aDocument->CSSLoader());
|
||||
|
@ -1639,6 +1652,9 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
|
|||
tokenStream->mTokenStream)) {
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
MOZ_ASSERT(styleBackend != StyleBackendType::Servo ||
|
||||
|
@ -1678,6 +1694,7 @@ DistributeRange(const Range<Keyframe>& aRange)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template
|
||||
nsTArray<AnimationProperty>
|
||||
KeyframeUtils::GetAnimationPropertiesFromKeyframes(
|
||||
|
@ -1685,6 +1702,7 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes(
|
|||
dom::Element* aElement,
|
||||
GeckoStyleContext* aStyle,
|
||||
dom::CompositeOperation aEffectComposite);
|
||||
#endif
|
||||
|
||||
template
|
||||
nsTArray<AnimationProperty>
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include "mozilla/ServoCSSParser.h"
|
||||
#include "nsCSSParser.h" // For nsCSSParser
|
||||
#include "nsIDocument.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -132,6 +134,7 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
|||
return Some(ComputedTimingFunction(timingFunction));
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
|
||||
|
@ -182,6 +185,10 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
|||
}
|
||||
|
||||
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ EXPORTS.mozilla += [
|
|||
'AnimationPropertySegment.h',
|
||||
'AnimationTarget.h',
|
||||
'AnimationUtils.h',
|
||||
'AnimValuesStyleRule.h',
|
||||
'ComputedTiming.h',
|
||||
'ComputedTimingFunction.h',
|
||||
'EffectCompositor.h',
|
||||
|
@ -42,6 +41,11 @@ EXPORTS.mozilla += [
|
|||
'TimingParams.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_OLD_STYLE']:
|
||||
EXPORTS.mozilla += [
|
||||
'AnimValuesStyleRule.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'Animation.cpp',
|
||||
'AnimationEffectReadOnly.cpp',
|
||||
|
@ -51,7 +55,6 @@ UNIFIED_SOURCES += [
|
|||
'AnimationPerformanceWarning.cpp',
|
||||
'AnimationTimeline.cpp',
|
||||
'AnimationUtils.cpp',
|
||||
'AnimValuesStyleRule.cpp',
|
||||
'ComputedTimingFunction.cpp',
|
||||
'CSSPseudoElement.cpp',
|
||||
'DocumentTimeline.cpp',
|
||||
|
@ -64,6 +67,11 @@ UNIFIED_SOURCES += [
|
|||
'TimingParams.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_OLD_STYLE']:
|
||||
UNIFIED_SOURCES += [
|
||||
'AnimValuesStyleRule.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
'/layout/base',
|
||||
|
|
|
@ -121,6 +121,7 @@ DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
|
|||
&mRootMargin);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// By not passing a CSS Loader object we make sure we don't parse in quirks
|
||||
// mode so that pixel/percent and unit-less values will be differentiated.
|
||||
nsCSSParser parser(nullptr);
|
||||
|
@ -139,6 +140,9 @@ DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
|
|||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -683,6 +683,7 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
bool parseSuccess = parser.ParseTransformProperty(aTransformList,
|
||||
|
@ -713,6 +714,9 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
|||
nullptr, nullptr, dummy, dummyBox,
|
||||
nsPresContext::AppUnitsPerCSSPixel(),
|
||||
&contains3dTransform);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!contains3dTransform) {
|
||||
|
|
|
@ -112,9 +112,11 @@
|
|||
#include "nsView.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsTextNode.h"
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -3538,6 +3540,7 @@ Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
|
|||
return const_cast<Element*>(Servo_SelectorList_Closest(this, aList));
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) -> Element* {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
// Either we failed (and aError already has the exception), or this
|
||||
// is a pseudo-element-only selector that matches nothing.
|
||||
|
@ -3558,6 +3561,9 @@ Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
|
|||
}
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -3575,6 +3581,7 @@ Element::Matches(const nsAString& aSelector, ErrorResult& aError)
|
|||
return Servo_SelectorList_Matches(this, aList);
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
// Either we failed (and aError already has the exception), or this
|
||||
// is a pseudo-element-only selector that matches nothing.
|
||||
|
@ -3588,6 +3595,9 @@ Element::Matches(const nsAString& aSelector, ErrorResult& aError)
|
|||
matchingContext.AddScopeElement(this);
|
||||
return nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
|
||||
aList);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -454,10 +454,12 @@ public:
|
|||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Directionality GetDirectionality() const {
|
||||
if (HasFlag(NODE_HAS_DIRECTION_RTL)) {
|
||||
|
|
|
@ -98,8 +98,10 @@
|
|||
#include "nsViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "ChildIterator.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsTextNode.h"
|
||||
#include "mozilla/dom/NodeListBinding.h"
|
||||
|
||||
|
@ -125,6 +127,7 @@
|
|||
#include "nsStyledElement.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsChildContentList.h"
|
||||
#include "mozilla/BloomFilter.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsCSSProps.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsMediaList.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -249,6 +251,7 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
|||
return !!mServoSourceSizeList;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser cssParser;
|
||||
|
||||
mSizeQueries.Clear();
|
||||
|
@ -256,6 +259,9 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
|||
|
||||
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
|
||||
mSizeQueries, mSizeValues);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -459,6 +465,7 @@ ResponsiveImageSelector::ComputeFinalWidthForCurrentViewport(double *aWidth)
|
|||
effectiveWidth = presShell->StyleSet()->AsServo()->EvaluateSourceSizeList(
|
||||
mServoSourceSizeList.get());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
unsigned int numSizes = mSizeQueries.Length();
|
||||
MOZ_ASSERT(numSizes == mSizeValues.Length(),
|
||||
"mSizeValues length differs from mSizeQueries");
|
||||
|
@ -479,6 +486,9 @@ ResponsiveImageSelector::ComputeFinalWidthForCurrentViewport(double *aWidth)
|
|||
effectiveWidth = nsRuleNode::CalcLengthWithInitialFont(pctx,
|
||||
mSizeValues[i]);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
*aWidth = nsPresContext::AppUnitsToDoubleCSSPixels(std::max(effectiveWidth, 0));
|
||||
|
|
|
@ -125,9 +125,11 @@ private:
|
|||
// Servo bits.
|
||||
UniquePtr<RawServoSourceSizeList> mServoSourceSizeList;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Gecko bits.
|
||||
nsTArray< nsAutoPtr<nsMediaQuery> > mSizeQueries;
|
||||
nsTArray<nsCSSValue> mSizeValues;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ResponsiveImageCandidate {
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
#include "mozilla/dom/StyleSheetList.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#endif
|
||||
#include "mozilla/dom/StyleSheetListBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#include "nsMappedAttributeElement.h"
|
||||
#include "nsString.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsContentUtils.h" // nsAutoScriptBlocker
|
||||
|
@ -629,6 +631,7 @@ nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
return MakeMappedUnique(mapped);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -636,6 +639,7 @@ nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
|
|||
aRuleWalker->Forward(mImpl->mMappedAttrs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsAttrAndChildArray::Compact()
|
||||
|
|
|
@ -125,7 +125,9 @@ public:
|
|||
}
|
||||
return DoSetMappedAttrStyleSheet(aSheet);
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker);
|
||||
#endif
|
||||
|
||||
void Compact();
|
||||
|
||||
|
|
|
@ -1744,10 +1744,14 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
|
|||
ownerDoc->GetCompatibilityMode(),
|
||||
ownerDoc->CSSLoader());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
css::Loader* cssLoader = ownerDoc->CSSLoader();
|
||||
nsCSSParser cssParser(cssLoader);
|
||||
decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
|
||||
principal);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (!decl) {
|
||||
return false;
|
||||
|
|
|
@ -2882,6 +2882,7 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue computedValue;
|
||||
if (!StyleAnimationValue::ExtractComputedValue(propertyID,
|
||||
styleContext->AsGecko(),
|
||||
|
@ -2915,6 +2916,9 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
|||
MOZ_ASSERT(uncomputeResult,
|
||||
"Unable to get specified value from computed value");
|
||||
return NS_OK;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -234,7 +234,9 @@
|
|||
#include "nsITextControlElement.h"
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
#include "nsIEditor.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsISecurityConsoleMessage.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
|
@ -1333,12 +1335,17 @@ nsIDocument::SelectorCache::SelectorList::Reset()
|
|||
}
|
||||
} else {
|
||||
if (mGecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
delete mGecko;
|
||||
mGecko = nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// CacheList takes ownership of aSelectorList.
|
||||
void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
|
||||
mozilla::UniquePtr<nsCSSSelectorList>&& aSelectorList)
|
||||
|
@ -1348,6 +1355,7 @@ void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
|
|||
mTable.Put(key->mKey, SelectorList(Move(aSelectorList)));
|
||||
AddObject(key);
|
||||
}
|
||||
#endif
|
||||
|
||||
void nsIDocument::SelectorCache::CacheList(
|
||||
const nsAString& aSelector,
|
||||
|
@ -1963,7 +1971,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
|||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChannel)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleAttrStyleSheet)
|
||||
#endif
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mXPathEvaluator)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLayoutHistoryState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnloadBlocker)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsAtom.h"
|
||||
#include "nsIFrame.h"
|
||||
|
|
|
@ -1176,8 +1176,12 @@ public:
|
|||
mServo = aOther.mServo;
|
||||
aOther.mServo = nullptr;
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mGecko = aOther.mGecko;
|
||||
aOther.mGecko = nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -1189,10 +1193,12 @@ public:
|
|||
, mServo(aList.release())
|
||||
{}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
explicit SelectorList(mozilla::UniquePtr<nsCSSSelectorList>&& aList)
|
||||
: mIsServo(false)
|
||||
, mGecko(aList.release())
|
||||
{}
|
||||
#endif
|
||||
|
||||
~SelectorList() {
|
||||
Reset();
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
|
@ -83,7 +85,9 @@
|
|||
#include "nsPIBoxObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPresContext.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsString.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsSVGUtils.h"
|
||||
|
@ -93,7 +97,9 @@
|
|||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "xpcpublic.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsCSSParser.h"
|
||||
#include "HTMLLegendElement.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
|
@ -2634,6 +2640,7 @@ nsINode::ParseServoSelectorList(
|
|||
return selectorList;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSSelectorList*
|
||||
nsINode::ParseSelectorList(const nsAString& aSelectorString,
|
||||
ErrorResult& aRv)
|
||||
|
@ -2715,11 +2722,14 @@ AddScopeElements(TreeMatchContext& aMatchContext,
|
|||
aMatchContext.AddScopeElement(aMatchContextNode->AsElement());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
struct SelectorMatchInfo {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSSelectorList* const mSelectorList;
|
||||
TreeMatchContext& mMatchContext;
|
||||
#endif
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -2755,10 +2765,13 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
|
|||
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
|
||||
// We have an element with the right id and it's a strict descendant
|
||||
// of aRoot. Make sure it really matches the selector.
|
||||
if (!aMatchInfo ||
|
||||
nsCSSRuleProcessor::SelectorListMatches(element,
|
||||
aMatchInfo->mMatchContext,
|
||||
aMatchInfo->mSelectorList)) {
|
||||
if (!aMatchInfo
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|| nsCSSRuleProcessor::SelectorListMatches(element,
|
||||
aMatchInfo->mMatchContext,
|
||||
aMatchInfo->mSelectorList)
|
||||
#endif
|
||||
) {
|
||||
aList.AppendElement(element);
|
||||
if (onlyFirstMatch) {
|
||||
return;
|
||||
|
@ -2768,6 +2781,7 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Actually find elements matching aSelectorList (which must not be
|
||||
// null) and which are descendants of aRoot and put them in aList. If
|
||||
// onlyFirstMatch, then stop once the first one is found.
|
||||
|
@ -2827,6 +2841,7 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ElementHolder {
|
||||
ElementHolder() : mElement(nullptr) {}
|
||||
|
@ -2856,6 +2871,7 @@ nsINode::QuerySelector(const nsAString& aSelector, ErrorResult& aResult)
|
|||
Servo_SelectorList_QueryFirst(this, aList, useInvalidation));
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) -> Element* {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
// Either we failed (and aResult already has the exception), or this
|
||||
// is a pseudo-element-only selector that matches nothing.
|
||||
|
@ -2864,6 +2880,9 @@ nsINode::QuerySelector(const nsAString& aSelector, ErrorResult& aResult)
|
|||
ElementHolder holder;
|
||||
FindMatchingElements<true, ElementHolder>(this, aList, holder, aResult);
|
||||
return holder.mElement;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -2885,11 +2904,15 @@ nsINode::QuerySelectorAll(const nsAString& aSelector, ErrorResult& aResult)
|
|||
this, aList, contentList.get(), useInvalidation);
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
return;
|
||||
}
|
||||
FindMatchingElements<false, AutoTArray<Element*, 128>>(
|
||||
this, aList, *contentList, aResult);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -2182,7 +2182,11 @@ protected:
|
|||
if (IsStyledByServo()) {
|
||||
return aServoFunctor(ParseServoSelectorList(aSelectorString, aRv));
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return aGeckoFunctor(ParseSelectorList(aSelectorString, aRv));
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
#include "nsMappedAttributeElement.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsresult
|
||||
nsMappedAttributeElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
mAttrsAndChildren.WalkMappedAttributeStyleRules(aRuleWalker);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsMappedAttributeElement::SetAndSwapMappedAttribute(nsAtom* aName,
|
||||
|
|
|
@ -39,7 +39,9 @@ public:
|
|||
static void MapNoAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
#endif
|
||||
virtual bool SetAndSwapMappedAttribute(nsAtom* aName,
|
||||
nsAttrValue& aValue,
|
||||
bool* aValueWasSet,
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "mozilla/GenericSpecifiedValues.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
@ -149,11 +151,13 @@ nsMappedAttributes::LastRelease()
|
|||
delete this;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMPL_ADDREF(nsMappedAttributes)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(nsMappedAttributes, LastRelease())
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(nsMappedAttributes,
|
||||
nsIStyleRule)
|
||||
#endif
|
||||
|
||||
void
|
||||
nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
|
||||
|
@ -254,6 +258,7 @@ nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
mSheet = aSheet; // not ref counted
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
|
@ -302,6 +307,7 @@ nsMappedAttributes::List(FILE* out, int32_t aIndent) const
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
nsMappedAttributes::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
|
||||
#include "nsAttrAndChildArray.h"
|
||||
#include "nsMappedAttributeElement.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
@ -22,7 +24,10 @@
|
|||
class nsAtom;
|
||||
class nsHTMLStyleSheet;
|
||||
|
||||
class nsMappedAttributes final : public nsIStyleRule
|
||||
class nsMappedAttributes final
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
: public nsIStyleRule
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
nsMappedAttributes(nsHTMLStyleSheet* aSheet,
|
||||
|
@ -32,7 +37,11 @@ public:
|
|||
void* operator new(size_t size, uint32_t aAttrCount = 1) CPP_THROW_NEW;
|
||||
nsMappedAttributes* Clone(bool aWillAddAttr);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_DECL_ISUPPORTS
|
||||
#else
|
||||
NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(nsMappedAttributes, LastRelease())
|
||||
#endif
|
||||
|
||||
void SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
|
||||
bool* aValueWasSet);
|
||||
|
@ -90,6 +99,7 @@ public:
|
|||
mServoStyle = nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// nsIStyleRule
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
|
@ -97,6 +107,7 @@ public:
|
|||
nsCSSValue* aValue) override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
|
|
@ -427,7 +427,11 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
|||
if (mStyleSheet->IsServo()) {
|
||||
// XXXheycam ServoStyleSheets don't support <style scoped>.
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,6 +603,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
CSSStyleSheet* sheet = mStyleSheet->AsGecko();
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(this);
|
||||
|
@ -637,4 +642,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
|
|||
if (newScopeElement) {
|
||||
newScopeElement->SetIsElementInStyleScopeFlagOnSubtree(true);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -7,11 +7,14 @@
|
|||
#include "nsTreeSanitizer.h"
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/BindingStyleRule.h"
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/ServoDeclarationBlock.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/css/Rule.h"
|
||||
#include "mozilla/dom/CSSRuleList.h"
|
||||
#include "mozilla/dom/SRIMetadata.h"
|
||||
|
@ -1094,8 +1097,12 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
|||
CORS_NONE, aDocument->GetReferrerPolicy(),
|
||||
SRIMetadata());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
sheet = new CSSStyleSheet(mozilla::css::eAuthorSheetFeatures,
|
||||
CORS_NONE, aDocument->GetReferrerPolicy());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
|
||||
sheet->SetPrincipal(aDocument->NodePrincipal());
|
||||
|
@ -1105,10 +1112,14 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
|||
aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
|
||||
0, aDocument->GetCompatibilityMode());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Create the CSS parser, and parse the CSS text.
|
||||
nsCSSParser parser(nullptr, sheet->AsGecko());
|
||||
rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
|
||||
aDocument->NodePrincipal(), 0);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
// Mark the sheet as complete.
|
||||
|
@ -1188,12 +1199,16 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
|
|||
document->GetCompatibilityMode(),
|
||||
document->CSSLoader());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Pass the CSS Loader object to the parser, to allow parser error
|
||||
// reports to include the outer window ID.
|
||||
nsCSSParser parser(document->CSSLoader());
|
||||
decl = parser.ParseStyleAttribute(value, document->GetDocumentURI(),
|
||||
aElement->GetBaseURIForStyleAttr(),
|
||||
document->NodePrincipal());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (decl) {
|
||||
if (SanitizeStyleDeclaration(decl)) {
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#ifndef nsTreeSanitizer_h_
|
||||
#define nsTreeSanitizer_h_
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
|
|
|
@ -27,10 +27,14 @@
|
|||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
|
@ -756,10 +760,18 @@ CanvasGradient::AddColorStop(float aOffset, const nsAString& aColorstr, ErrorRes
|
|||
? shell->StyleSet()->GetAsServo()
|
||||
: nullptr;
|
||||
|
||||
if (servoStyleSet) {
|
||||
bool useServoParser =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
servoStyleSet;
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
|
||||
if (useServoParser) {
|
||||
ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColorstr,
|
||||
&color);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
|
||||
|
@ -767,6 +779,9 @@ CanvasGradient::AddColorStop(float aOffset, const nsAString& aColorstr, ErrorRes
|
|||
|
||||
ok = parser.ParseColorString(aColorstr, nullptr, 0, value) &&
|
||||
nsRuleNode::ComputeColor(value, presContext, nullptr, color);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
|
@ -1166,9 +1181,15 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
nsIDocument* document = mCanvasElement ? mCanvasElement->OwnerDoc() : nullptr;
|
||||
css::Loader* loader = document ? document->CSSLoader() : nullptr;
|
||||
|
||||
// FIXME(bug 1420026).
|
||||
if (false) {
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
bool useServoParser =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
document && document->IsStyledByServo();
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
|
||||
if (useServoParser) {
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
ServoStyleSet* set = presShell ? presShell->StyleSet()->AsServo() : nullptr;
|
||||
|
||||
// First, try computing the color without handling currentcolor.
|
||||
|
@ -1178,16 +1199,20 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (wasCurrentColor) {
|
||||
if (wasCurrentColor && mCanvasElement) {
|
||||
// Otherwise, get the value of the color property, flushing style
|
||||
// if necessary.
|
||||
RefPtr<nsStyleContext> canvasStyle =
|
||||
nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr, presShell);
|
||||
*aColor = canvasStyle->StyleColor()->mColor;
|
||||
if (canvasStyle) {
|
||||
*aColor = canvasStyle->StyleColor()->mColor;
|
||||
}
|
||||
// Beware that the presShell could be gone here.
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Pass the CSS Loader object to the parser, to allow parser error
|
||||
// reports to include the outer window ID.
|
||||
nsCSSParser parser(loader);
|
||||
|
@ -1215,6 +1240,9 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
*aColor);
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2667,6 +2695,7 @@ CanvasRenderingContext2D::SetShadowColor(const nsAString& aShadowColor)
|
|||
// filters
|
||||
//
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static already_AddRefed<Declaration>
|
||||
CreateDeclaration(nsINode* aNode,
|
||||
const nsCSSPropertyID aProp1, const nsAString& aValue1, bool* aChanged1,
|
||||
|
@ -2819,6 +2848,7 @@ GetFontStyleContext(Element* aElement, const nsAString& aFont,
|
|||
|
||||
return sc.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateDeclarationForServo(nsCSSPropertyID aProperty,
|
||||
|
@ -2928,6 +2958,7 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
|||
return sc.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static already_AddRefed<Declaration>
|
||||
CreateFilterDeclaration(const nsAString& aFilter,
|
||||
nsINode* aNode,
|
||||
|
@ -2972,6 +3003,7 @@ ResolveFilterStyle(const nsAString& aFilterString,
|
|||
|
||||
return sc.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateFilterDeclarationForServo(const nsAString& aFilter,
|
||||
|
@ -3028,6 +3060,7 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
|
||||
nsString usedFont;
|
||||
if (presShell->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<GeckoStyleContext> parentContext =
|
||||
GetFontStyleContext(mCanvasElement, GetFont(),
|
||||
presShell, usedFont, aError);
|
||||
|
@ -3043,6 +3076,10 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
}
|
||||
aFilterChain = sc->StyleEffects()->mFilters;
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// For stylo
|
||||
|
@ -3980,8 +4017,12 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
|||
sc =
|
||||
GetFontStyleForServo(mCanvasElement, aFont, presShell, usedFont, aError);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
sc =
|
||||
GetFontStyleContext(mCanvasElement, aFont, presShell, usedFont, aError);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (!sc) {
|
||||
return false;
|
||||
|
|
|
@ -434,7 +434,7 @@ public:
|
|||
/**
|
||||
* Gets the pres shell from either the canvas element or the doc shell
|
||||
*/
|
||||
virtual nsIPresShell *GetPresShell() override {
|
||||
nsIPresShell* GetPresShell() final {
|
||||
if (mCanvasElement) {
|
||||
return mCanvasElement->OwnerDoc()->GetShell();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#include "nsLayoutUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSValue.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "mozilla/ServoCSSParser.h"
|
||||
|
||||
|
@ -72,12 +74,16 @@ DocumentRendererChild::RenderDocument(nsPIDOMWindowOuter* window,
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
nsCSSValue bgColorValue;
|
||||
if (!parser.ParseColorString(aBGColor, nullptr, 0, bgColorValue) ||
|
||||
!nsRuleNode::ComputeColor(bgColorValue, presContext, nullptr, bgColor)) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw directly into the output array.
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsIDocShell.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "nsGlobalWindow.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Body)
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRule.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
#include "nsIListControlFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsAtom.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "celldata.h"
|
||||
#include "mozilla/dom/HTMLTableCellElementBinding.h"
|
||||
|
||||
|
@ -93,6 +95,7 @@ HTMLTableCellElement::CellIndex() const
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -106,6 +109,7 @@ HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsMappedAttributes*
|
||||
HTMLTableCellElement::GetMappedAttributesInheritedFromTable() const
|
||||
|
|
|
@ -142,7 +142,9 @@ public:
|
|||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
#endif
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
// Get mapped attributes of ancestor table, if any
|
||||
nsMappedAttributes* GetMappedAttributesInheritedFromTable() const;
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsNetUtil.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsVideoFrame.h"
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#include "nsQueryObject.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
var testPath = "http://mochi.test:8888/browser/dom/html/test/";
|
||||
var popup;
|
||||
|
||||
var {LoadContextInfo} = ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm", null);
|
||||
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm", null);
|
||||
|
||||
function checkCache(url, inMemory, shouldExist, cb)
|
||||
{
|
||||
var cache = Services.cache2;
|
||||
var storage = cache.diskCacheStorage(LoadContextInfo.default, false);
|
||||
var storage = cache.diskCacheStorage(Services.loadContextInfo.default, false);
|
||||
|
||||
function CheckCacheListener(inMemory, shouldExist)
|
||||
{
|
||||
|
|
|
@ -1586,6 +1586,7 @@ StartMacOSContentSandbox()
|
|||
info.appBinaryPath.assign(appBinaryPath.get());
|
||||
info.appDir.assign(appDir.get());
|
||||
info.appTempDir.assign(tempDirPath.get());
|
||||
info.hasAudio = !Preferences::GetBool("media.cubeb.sandbox");
|
||||
|
||||
// These paths are used to whitelist certain directories used by the testing
|
||||
// system. They should not be considered a public API, and are only intended
|
||||
|
|
|
@ -2238,7 +2238,13 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
|||
|
||||
// Content processes have no permission to access profile directory, so we
|
||||
// send the file URL instead.
|
||||
StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
|
||||
StyleBackendType backendType =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleBackendType::Gecko;
|
||||
#else
|
||||
StyleBackendType::Servo;
|
||||
#endif
|
||||
StyleSheet* ucs = nsLayoutStylesheetCache::For(backendType)->UserContentSheet();
|
||||
if (ucs) {
|
||||
SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL());
|
||||
} else {
|
||||
|
@ -2358,25 +2364,21 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
|||
// send two loads.
|
||||
//
|
||||
// The URIs of the Gecko and Servo sheets should be the same, so it
|
||||
// shouldn't matter which we look at. (The Servo sheets don't exist
|
||||
// in non-MOZ-STYLO builds, though, so look at the Gecko ones.)
|
||||
// shouldn't matter which we look at.
|
||||
|
||||
for (StyleSheet* sheet :
|
||||
*sheetService->AgentStyleSheets(StyleBackendType::Gecko)) {
|
||||
for (StyleSheet* sheet : *sheetService->AgentStyleSheets(backendType)) {
|
||||
URIParams uri;
|
||||
SerializeURI(sheet->GetSheetURI(), uri);
|
||||
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
for (StyleSheet* sheet :
|
||||
*sheetService->UserStyleSheets(StyleBackendType::Gecko)) {
|
||||
for (StyleSheet* sheet : *sheetService->UserStyleSheets(backendType)) {
|
||||
URIParams uri;
|
||||
SerializeURI(sheet->GetSheetURI(), uri);
|
||||
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
|
||||
}
|
||||
|
||||
for (StyleSheet* sheet :
|
||||
*sheetService->AuthorStyleSheets(StyleBackendType::Gecko)) {
|
||||
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets(backendType)) {
|
||||
URIParams uri;
|
||||
SerializeURI(sheet->GetSheetURI(), uri);
|
||||
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
|
||||
#include "nsCRT.h"
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
|
|
@ -112,9 +112,6 @@ DIRS += [
|
|||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DIRS += ['plugins/ipc/hangui']
|
||||
|
||||
if CONFIG['MOZ_SECUREELEMENT']:
|
||||
DIRS += ['secureelement']
|
||||
|
||||
DIRS += ['presentation']
|
||||
|
||||
TEST_DIRS += [
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef mozilla_dom_PaymentRequestService_h
|
||||
#define mozilla_dom_PaymentRequestService_h
|
||||
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsIPaymentRequest.h"
|
||||
#include "nsIPaymentRequestService.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
|
|
@ -1,612 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
/* Copyright © 2014, Deutsche Telekom, Inc. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* globals dump, Components, XPCOMUtils, DOMRequestIpcHelper, cpmm, SE */
|
||||
|
||||
const DEBUG = false;
|
||||
function debug(s) {
|
||||
if (DEBUG) {
|
||||
dump("-*- SecureElement DOM: " + s + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "SE", function() {
|
||||
let obj = {};
|
||||
ChromeUtils.import("resource://gre/modules/se_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
// Extend / Inherit from Error object
|
||||
function SEError(name, message) {
|
||||
this.name = name || SE.ERROR_GENERIC;
|
||||
this.message = message || "";
|
||||
}
|
||||
|
||||
SEError.prototype = {
|
||||
__proto__: Error.prototype,
|
||||
};
|
||||
|
||||
function PromiseHelpersSubclass(win) {
|
||||
this._window = win;
|
||||
}
|
||||
|
||||
PromiseHelpersSubclass.prototype = {
|
||||
__proto__: DOMRequestIpcHelper.prototype,
|
||||
|
||||
_window: null,
|
||||
|
||||
_context: [],
|
||||
|
||||
createSEPromise: function createSEPromise(callback, /* optional */ ctx) {
|
||||
let ctxCallback = (resolverId) => {
|
||||
if (ctx) {
|
||||
this._context[resolverId] = ctx;
|
||||
}
|
||||
|
||||
callback(resolverId);
|
||||
};
|
||||
|
||||
return this.createPromiseWithId((aResolverId) => {
|
||||
ctxCallback(aResolverId);
|
||||
});
|
||||
},
|
||||
|
||||
takePromise: function takePromise(resolverId) {
|
||||
let resolver = this.takePromiseResolver(resolverId);
|
||||
if (!resolver) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the context associated with this resolverId
|
||||
let context = this._context[resolverId];
|
||||
delete this._context[resolverId];
|
||||
|
||||
return {resolver: resolver, context: context};
|
||||
},
|
||||
|
||||
rejectWithSEError: function rejectWithSEError(name, message) {
|
||||
let error = new SEError(name, message);
|
||||
debug("rejectWithSEError - " + error.toString());
|
||||
|
||||
return this._window.Promise.reject(Cu.cloneInto(error, this._window));
|
||||
}
|
||||
};
|
||||
|
||||
// Helper wrapper class to do promises related chores
|
||||
var PromiseHelpers;
|
||||
|
||||
/**
|
||||
* Instance of 'SEReaderImpl' class is the connector to a secure element.
|
||||
* A reader may or may not have a secure element present, since some
|
||||
* secure elements are removable in nature (eg:- 'uicc'). These
|
||||
* Readers can be physical devices or virtual devices.
|
||||
*/
|
||||
function SEReaderImpl() {}
|
||||
|
||||
SEReaderImpl.prototype = {
|
||||
_window: null,
|
||||
|
||||
_sessions: [],
|
||||
|
||||
type: null,
|
||||
_isSEPresent: false,
|
||||
|
||||
classID: Components.ID("{1c7bdba3-cd35-4f8b-a546-55b3232457d5}"),
|
||||
contractID: "@mozilla.org/secureelement/reader;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
|
||||
// Chrome-only function
|
||||
onSessionClose: function onSessionClose(sessionCtx) {
|
||||
let index = this._sessions.indexOf(sessionCtx);
|
||||
if (index != -1) {
|
||||
this._sessions.splice(index, 1);
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function initialize(win, type, isPresent) {
|
||||
this._window = win;
|
||||
this.type = type;
|
||||
this._isSEPresent = isPresent;
|
||||
},
|
||||
|
||||
_checkPresence: function _checkPresence() {
|
||||
if (!this._isSEPresent) {
|
||||
throw new Error(SE.ERROR_NOTPRESENT);
|
||||
}
|
||||
},
|
||||
|
||||
openSession: function openSession() {
|
||||
this._checkPresence();
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
let sessionImpl = new SESessionImpl();
|
||||
sessionImpl.initialize(this._window, this);
|
||||
this._window.SESession._create(this._window, sessionImpl);
|
||||
this._sessions.push(sessionImpl);
|
||||
PromiseHelpers.takePromiseResolver(resolverId)
|
||||
.resolve(sessionImpl.__DOM_IMPL__);
|
||||
});
|
||||
},
|
||||
|
||||
closeAll: function closeAll() {
|
||||
this._checkPresence();
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
let promises = [];
|
||||
for (let session of this._sessions) {
|
||||
if (!session.isClosed) {
|
||||
promises.push(session.closeAll());
|
||||
}
|
||||
}
|
||||
|
||||
let resolver = PromiseHelpers.takePromiseResolver(resolverId);
|
||||
// Wait till all the promises are resolved
|
||||
Promise.all(promises).then(() => {
|
||||
this._sessions = [];
|
||||
resolver.resolve();
|
||||
}, (reason) => {
|
||||
let error = new SEError(SE.ERROR_BADSTATE,
|
||||
"Unable to close all channels associated with this reader");
|
||||
resolver.reject(Cu.cloneInto(error, this._window));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
updateSEPresence: function updateSEPresence(isSEPresent) {
|
||||
if (!isSEPresent) {
|
||||
this.invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
this._isSEPresent = isSEPresent;
|
||||
},
|
||||
|
||||
invalidate: function invalidate() {
|
||||
debug("Invalidating SE reader: " + this.type);
|
||||
this._isSEPresent = false;
|
||||
this._sessions.forEach(s => s.invalidate());
|
||||
this._sessions = [];
|
||||
},
|
||||
|
||||
get isSEPresent() {
|
||||
return this._isSEPresent;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Instance of 'SESessionImpl' object represent a connection session
|
||||
* to one of the secure elements available on the device.
|
||||
* These objects can be used to get a communication channel with an application
|
||||
* hosted by the Secure Element.
|
||||
*/
|
||||
function SESessionImpl() {}
|
||||
|
||||
SESessionImpl.prototype = {
|
||||
_window: null,
|
||||
|
||||
_channels: [],
|
||||
|
||||
_isClosed: false,
|
||||
|
||||
_reader: null,
|
||||
|
||||
classID: Components.ID("{2b1809f8-17bd-4947-abd7-bdef1498561c}"),
|
||||
contractID: "@mozilla.org/secureelement/session;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
|
||||
// Chrome-only function
|
||||
onChannelOpen: function onChannelOpen(channelCtx) {
|
||||
this._channels.push(channelCtx);
|
||||
},
|
||||
|
||||
// Chrome-only function
|
||||
onChannelClose: function onChannelClose(channelCtx) {
|
||||
let index = this._channels.indexOf(channelCtx);
|
||||
if (index != -1) {
|
||||
this._channels.splice(index, 1);
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function initialize(win, readerCtx) {
|
||||
this._window = win;
|
||||
this._reader = readerCtx;
|
||||
},
|
||||
|
||||
openLogicalChannel: function openLogicalChannel(aid) {
|
||||
if (this._isClosed) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
|
||||
"Session Already Closed!");
|
||||
}
|
||||
|
||||
let aidLen = aid ? aid.length : 0;
|
||||
if (aidLen < SE.MIN_AID_LEN || aidLen > SE.MAX_AID_LEN) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER,
|
||||
"Invalid AID length - " + aidLen);
|
||||
}
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
/**
|
||||
* @params for 'SE:OpenChannel'
|
||||
*
|
||||
* resolverId : ID that identifies this IPC request.
|
||||
* aid : AID that identifies the applet on SecureElement
|
||||
* type : Reader type ('uicc' / 'eSE')
|
||||
* appId : Current appId obtained from 'Principal' obj
|
||||
*/
|
||||
cpmm.sendAsyncMessage("SE:OpenChannel", {
|
||||
resolverId: resolverId,
|
||||
aid: aid,
|
||||
type: this.reader.type,
|
||||
appId: this._window.document.nodePrincipal.appId
|
||||
});
|
||||
}, this);
|
||||
},
|
||||
|
||||
closeAll: function closeAll() {
|
||||
if (this._isClosed) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
|
||||
"Session Already Closed!");
|
||||
}
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
let promises = [];
|
||||
for (let channel of this._channels) {
|
||||
if (!channel.isClosed) {
|
||||
promises.push(channel.close());
|
||||
}
|
||||
}
|
||||
|
||||
let resolver = PromiseHelpers.takePromiseResolver(resolverId);
|
||||
Promise.all(promises).then(() => {
|
||||
this._isClosed = true;
|
||||
this._channels = [];
|
||||
// Notify parent of this session instance's closure, so that its
|
||||
// instance entry can be removed from the parent as well.
|
||||
this._reader.onSessionClose(this.__DOM_IMPL__);
|
||||
resolver.resolve();
|
||||
}, (reason) => {
|
||||
resolver.reject(new Error(SE.ERROR_BADSTATE +
|
||||
"Unable to close all channels associated with this session"));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
invalidate: function invlidate() {
|
||||
this._isClosed = true;
|
||||
this._channels.forEach(ch => ch.invalidate());
|
||||
this._channels = [];
|
||||
},
|
||||
|
||||
get reader() {
|
||||
return this._reader.__DOM_IMPL__;
|
||||
},
|
||||
|
||||
get isClosed() {
|
||||
return this._isClosed;
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Instance of 'SEChannelImpl' object represent an ISO/IEC 7816-4 specification
|
||||
* channel opened to a secure element. It can be either a logical channel
|
||||
* or basic channel.
|
||||
*/
|
||||
function SEChannelImpl() {}
|
||||
|
||||
SEChannelImpl.prototype = {
|
||||
_window: null,
|
||||
|
||||
_channelToken: null,
|
||||
|
||||
_isClosed: false,
|
||||
|
||||
_session: null,
|
||||
|
||||
openResponse: [],
|
||||
|
||||
type: null,
|
||||
|
||||
classID: Components.ID("{181ebcf4-5164-4e28-99f2-877ec6fa83b9}"),
|
||||
contractID: "@mozilla.org/secureelement/channel;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
|
||||
// Chrome-only function
|
||||
onClose: function onClose() {
|
||||
this._isClosed = true;
|
||||
// Notify the parent
|
||||
this._session.onChannelClose(this.__DOM_IMPL__);
|
||||
},
|
||||
|
||||
initialize: function initialize(win, channelToken, isBasicChannel,
|
||||
openResponse, sessionCtx) {
|
||||
this._window = win;
|
||||
// Update the 'channel token' that identifies and represents this
|
||||
// instance of the object
|
||||
this._channelToken = channelToken;
|
||||
// Update 'session' obj
|
||||
this._session = sessionCtx;
|
||||
this.openResponse = Cu.cloneInto(new Uint8Array(openResponse), win);
|
||||
this.type = isBasicChannel ? "basic" : "logical";
|
||||
},
|
||||
|
||||
transmit: function transmit(command) {
|
||||
// TODO remove this once it will be possible to have a non-optional dict
|
||||
// in the WebIDL
|
||||
if (!command) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER,
|
||||
"SECommand dict must be defined");
|
||||
}
|
||||
|
||||
if (this._isClosed) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
|
||||
"Channel Already Closed!");
|
||||
}
|
||||
|
||||
let dataLen = command.data ? command.data.length : 0;
|
||||
if (dataLen > SE.MAX_APDU_LEN) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER,
|
||||
" Command data length exceeds max limit - 255. " +
|
||||
" Extended APDU is not supported!");
|
||||
}
|
||||
|
||||
if ((command.cla & 0x80 === 0) && ((command.cla & 0x60) !== 0x20)) {
|
||||
if (command.ins === SE.INS_MANAGE_CHANNEL) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY,
|
||||
"MANAGE CHANNEL command not permitted");
|
||||
}
|
||||
if ((command.ins === SE.INS_SELECT) && (command.p1 == 0x04)) {
|
||||
// SELECT by DF Name (p1=04) is not allowed
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY,
|
||||
"SELECT command not permitted");
|
||||
}
|
||||
debug("Attempting to transmit an ISO command");
|
||||
} else {
|
||||
debug("Attempting to transmit GlobalPlatform command");
|
||||
}
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
/**
|
||||
* @params for 'SE:TransmitAPDU'
|
||||
*
|
||||
* resolverId : Id that identifies this IPC request.
|
||||
* apdu : Object containing APDU data
|
||||
* channelToken: Token that identifies the current channel over which
|
||||
'c-apdu' is being sent.
|
||||
* appId : Current appId obtained from 'Principal' obj
|
||||
*/
|
||||
cpmm.sendAsyncMessage("SE:TransmitAPDU", {
|
||||
resolverId: resolverId,
|
||||
apdu: command,
|
||||
channelToken: this._channelToken,
|
||||
appId: this._window.document.nodePrincipal.appId
|
||||
});
|
||||
}, this);
|
||||
},
|
||||
|
||||
close: function close() {
|
||||
if (this._isClosed) {
|
||||
return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
|
||||
"Channel Already Closed!");
|
||||
}
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
/**
|
||||
* @params for 'SE:CloseChannel'
|
||||
*
|
||||
* resolverId : Id that identifies this IPC request.
|
||||
* channelToken: Token that identifies the current channel over which
|
||||
'c-apdu' is being sent.
|
||||
* appId : Current appId obtained from 'Principal' obj
|
||||
*/
|
||||
cpmm.sendAsyncMessage("SE:CloseChannel", {
|
||||
resolverId: resolverId,
|
||||
channelToken: this._channelToken,
|
||||
appId: this._window.document.nodePrincipal.appId
|
||||
});
|
||||
}, this);
|
||||
},
|
||||
|
||||
invalidate: function invalidate() {
|
||||
this._isClosed = true;
|
||||
},
|
||||
|
||||
get session() {
|
||||
return this._session.__DOM_IMPL__;
|
||||
},
|
||||
|
||||
get isClosed() {
|
||||
return this._isClosed;
|
||||
},
|
||||
};
|
||||
|
||||
function SEResponseImpl() {}
|
||||
|
||||
SEResponseImpl.prototype = {
|
||||
sw1: 0x00,
|
||||
|
||||
sw2: 0x00,
|
||||
|
||||
data: null,
|
||||
|
||||
_channel: null,
|
||||
|
||||
classID: Components.ID("{58bc6c7b-686c-47cc-8867-578a6ed23f4e}"),
|
||||
contractID: "@mozilla.org/secureelement/response;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
|
||||
initialize: function initialize(sw1, sw2, response, channelCtx) {
|
||||
// Update the status bytes
|
||||
this.sw1 = sw1;
|
||||
this.sw2 = sw2;
|
||||
this.data = response ? response.slice(0) : null;
|
||||
// Update the channel obj
|
||||
this._channel = channelCtx;
|
||||
},
|
||||
|
||||
get channel() {
|
||||
return this._channel.__DOM_IMPL__;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* SEManagerImpl
|
||||
*/
|
||||
function SEManagerImpl() {}
|
||||
|
||||
SEManagerImpl.prototype = {
|
||||
__proto__: DOMRequestIpcHelper.prototype,
|
||||
|
||||
_window: null,
|
||||
|
||||
classID: Components.ID("{4a8b6ec0-4674-11e4-916c-0800200c9a66}"),
|
||||
contractID: "@mozilla.org/secureelement/manager;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIDOMGlobalPropertyInitializer,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver
|
||||
]),
|
||||
|
||||
_readers: [],
|
||||
|
||||
init: function init(win) {
|
||||
this._window = win;
|
||||
PromiseHelpers = new PromiseHelpersSubclass(this._window);
|
||||
|
||||
// Add the messages to be listened to.
|
||||
const messages = ["SE:GetSEReadersResolved",
|
||||
"SE:OpenChannelResolved",
|
||||
"SE:CloseChannelResolved",
|
||||
"SE:TransmitAPDUResolved",
|
||||
"SE:GetSEReadersRejected",
|
||||
"SE:OpenChannelRejected",
|
||||
"SE:CloseChannelRejected",
|
||||
"SE:TransmitAPDURejected",
|
||||
"SE:ReaderPresenceChanged"];
|
||||
|
||||
this.initDOMRequestHelper(win, messages);
|
||||
},
|
||||
|
||||
// This function will be called from DOMRequestIPCHelper.
|
||||
uninit: function uninit() {
|
||||
// All requests that are still pending need to be invalidated
|
||||
// because the context is no longer valid.
|
||||
this.forEachPromiseResolver((k) => {
|
||||
this.takePromiseResolver(k).reject("Window Context got destroyed!");
|
||||
});
|
||||
PromiseHelpers = null;
|
||||
this._window = null;
|
||||
},
|
||||
|
||||
getSEReaders: function getSEReaders() {
|
||||
// invalidate previous readers on new request
|
||||
if (this._readers.length) {
|
||||
this._readers.forEach(r => r.invalidate());
|
||||
this._readers = [];
|
||||
}
|
||||
|
||||
return PromiseHelpers.createSEPromise((resolverId) => {
|
||||
cpmm.sendAsyncMessage("SE:GetSEReaders", {
|
||||
resolverId: resolverId,
|
||||
appId: this._window.document.nodePrincipal.appId
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
receiveMessage: function receiveMessage(message) {
|
||||
DEBUG && debug("Message received: " + JSON.stringify(message));
|
||||
|
||||
let result = message.data.result;
|
||||
let resolver = null;
|
||||
let context = null;
|
||||
|
||||
let promiseResolver = PromiseHelpers.takePromise(result.resolverId);
|
||||
if (promiseResolver) {
|
||||
resolver = promiseResolver.resolver;
|
||||
// This 'context' is the instance that originated this IPC message.
|
||||
context = promiseResolver.context;
|
||||
}
|
||||
|
||||
switch (message.name) {
|
||||
case "SE:GetSEReadersResolved":
|
||||
let readers = new this._window.Array();
|
||||
result.readers.forEach(reader => {
|
||||
let readerImpl = new SEReaderImpl();
|
||||
readerImpl.initialize(this._window, reader.type, reader.isPresent);
|
||||
this._window.SEReader._create(this._window, readerImpl);
|
||||
|
||||
this._readers.push(readerImpl);
|
||||
readers.push(readerImpl.__DOM_IMPL__);
|
||||
});
|
||||
resolver.resolve(readers);
|
||||
break;
|
||||
case "SE:OpenChannelResolved":
|
||||
let channelImpl = new SEChannelImpl();
|
||||
channelImpl.initialize(this._window,
|
||||
result.channelToken,
|
||||
result.isBasicChannel,
|
||||
result.openResponse,
|
||||
context);
|
||||
this._window.SEChannel._create(this._window, channelImpl);
|
||||
if (context) {
|
||||
// Notify context's handler with SEChannel instance
|
||||
context.onChannelOpen(channelImpl);
|
||||
}
|
||||
resolver.resolve(channelImpl.__DOM_IMPL__);
|
||||
break;
|
||||
case "SE:TransmitAPDUResolved":
|
||||
let responseImpl = new SEResponseImpl();
|
||||
responseImpl.initialize(result.sw1,
|
||||
result.sw2,
|
||||
result.response,
|
||||
context);
|
||||
this._window.SEResponse._create(this._window, responseImpl);
|
||||
resolver.resolve(responseImpl.__DOM_IMPL__);
|
||||
break;
|
||||
case "SE:CloseChannelResolved":
|
||||
if (context) {
|
||||
// Notify context's onClose handler
|
||||
context.onClose();
|
||||
}
|
||||
resolver.resolve();
|
||||
break;
|
||||
case "SE:GetSEReadersRejected":
|
||||
case "SE:OpenChannelRejected":
|
||||
case "SE:CloseChannelRejected":
|
||||
case "SE:TransmitAPDURejected":
|
||||
let error = new SEError(result.error, result.reason);
|
||||
resolver.reject(Cu.cloneInto(error, this._window));
|
||||
break;
|
||||
case "SE:ReaderPresenceChanged":
|
||||
debug("Reader " + result.type + " present: " + result.isPresent);
|
||||
let reader = this._readers.find(r => r.type === result.type);
|
||||
if (reader) {
|
||||
reader.updateSEPresence(result.isPresent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug("Could not find a handler for " + message.name);
|
||||
resolver.reject(Cu.cloneInto(new SEError(), this._window));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
|
||||
SEResponseImpl, SEChannelImpl, SESessionImpl, SEReaderImpl, SEManagerImpl
|
||||
]);
|
|
@ -1,14 +0,0 @@
|
|||
component {4a8b6ec0-4674-11e4-916c-0800200c9a66} DOMSecureElement.js
|
||||
contract @mozilla.org/secureelement/manager;1 {4a8b6ec0-4674-11e4-916c-0800200c9a66}
|
||||
|
||||
component {1c7bdba3-cd35-4f8b-a546-55b3232457d5} DOMSecureElement.js
|
||||
contract @mozilla.org/secureelement/reader;1 {1c7bdba3-cd35-4f8b-a546-55b3232457d5}
|
||||
|
||||
component {2b1809f8-17bd-4947-abd7-bdef1498561c} DOMSecureElement.js
|
||||
contract @mozilla.org/secureelement/session;1 {2b1809f8-17bd-4947-abd7-bdef1498561c}
|
||||
|
||||
component {181ebcf4-5164-4e28-99f2-877ec6fa83b9} DOMSecureElement.js
|
||||
contract @mozilla.org/secureelement/channel;1 {181ebcf4-5164-4e28-99f2-877ec6fa83b9}
|
||||
|
||||
component {58bc6c7b-686c-47cc-8867-578a6ed23f4e} DOMSecureElement.js
|
||||
contract @mozilla.org/secureelement/response;1 {58bc6c7b-686c-47cc-8867-578a6ed23f4e}
|
|
@ -1,16 +0,0 @@
|
|||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
#
|
||||
# Copyright © 2014 Deutsche Telekom, Inc.
|
||||
|
||||
# All of this seems to be FirefoxOS::NFC
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
|
||||
|
||||
if CONFIG['MOZ_SECUREELEMENT']:
|
||||
EXTRA_COMPONENTS += [
|
||||
'DOMSecureElement.js',
|
||||
'DOMSecureElement.manifest',
|
||||
]
|
|
@ -74,10 +74,16 @@ nsSMILCSSProperty::GetBaseValue() const
|
|||
if (!computedValue.mServo) {
|
||||
return baseValue;
|
||||
}
|
||||
} else if (!StyleAnimationValue::ExtractComputedValue(mPropID,
|
||||
mBaseStyleContext->AsGecko(),
|
||||
computedValue.mGecko)) {
|
||||
return baseValue;
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!StyleAnimationValue::ExtractComputedValue(mPropID,
|
||||
mBaseStyleContext->AsGecko(),
|
||||
computedValue.mGecko)) {
|
||||
return baseValue;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
baseValue =
|
||||
|
|
|
@ -41,10 +41,16 @@ struct ValueWrapper {
|
|||
mServoValues.AppendElement(aValue.mServo);
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mGeckoValue = aValue.mGecko;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
ValueWrapper(nsCSSPropertyID aPropID, const StyleAnimationValue& aValue)
|
||||
: mPropID(aPropID), mGeckoValue(aValue) {}
|
||||
#endif
|
||||
ValueWrapper(nsCSSPropertyID aPropID,
|
||||
const RefPtr<RawServoAnimationValue>& aValue)
|
||||
: mPropID(aPropID), mServoValues{(aValue)} {}
|
||||
|
@ -71,7 +77,11 @@ struct ValueWrapper {
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return mGeckoValue == aOther.mGeckoValue;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool operator!=(const ValueWrapper& aOther) const
|
||||
|
@ -81,12 +91,14 @@ struct ValueWrapper {
|
|||
|
||||
nsCSSPropertyID mPropID;
|
||||
ServoAnimationValues mServoValues;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue mGeckoValue;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
// Helper Methods
|
||||
// --------------
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static const StyleAnimationValue*
|
||||
GetZeroValueForUnit(StyleAnimationValue::Unit aUnit)
|
||||
{
|
||||
|
@ -114,6 +126,7 @@ GetZeroValueForUnit(StyleAnimationValue::Unit aUnit)
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If one argument is null, this method updates it to point to "zero"
|
||||
// for the other argument's Unit (if applicable; otherwise, we return false).
|
||||
|
@ -148,6 +161,7 @@ FinalizeServoAnimationValues(const RefPtr<RawServoAnimationValue>*& aValue1,
|
|||
return *aValue1 && *aValue2;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1,
|
||||
const StyleAnimationValue*& aValue2)
|
||||
|
@ -201,6 +215,7 @@ InvertSign(StyleAnimationValue& aValue)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static ValueWrapper*
|
||||
ExtractValueWrapper(nsSMILValue& aValue)
|
||||
|
@ -398,6 +413,7 @@ AddOrAccumulate(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
|||
aCount);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const StyleAnimationValue* valueToAdd = valueToAddWrapper ?
|
||||
&valueToAddWrapper->mGeckoValue : nullptr;
|
||||
const StyleAnimationValue* destValue = destWrapper ?
|
||||
|
@ -424,6 +440,9 @@ AddOrAccumulate(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
|||
return StyleAnimationValue::Add(property,
|
||||
destWrapper->mGeckoValue,
|
||||
*valueToAdd, aCount);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -500,6 +519,7 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
|
|||
return ComputeDistanceForServo(fromWrapper, *toWrapper, aDistance);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const StyleAnimationValue* fromCSSValue = fromWrapper ?
|
||||
&fromWrapper->mGeckoValue : nullptr;
|
||||
const StyleAnimationValue* toCSSValue = &toWrapper->mGeckoValue;
|
||||
|
@ -514,8 +534,12 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
|
|||
aDistance)
|
||||
? NS_OK
|
||||
: NS_ERROR_FAILURE;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static nsresult
|
||||
InterpolateForGecko(const ValueWrapper* aStartWrapper,
|
||||
const ValueWrapper& aEndWrapper,
|
||||
|
@ -540,6 +564,7 @@ InterpolateForGecko(const ValueWrapper* aStartWrapper,
|
|||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static nsresult
|
||||
InterpolateForServo(const ValueWrapper* aStartWrapper,
|
||||
|
@ -619,10 +644,14 @@ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
|
|||
aResult);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return InterpolateForGecko(startWrapper,
|
||||
*endWrapper,
|
||||
aUnitDistance,
|
||||
aResult);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper function to extract presContext
|
||||
|
@ -640,6 +669,7 @@ GetPresContextForElement(Element* aElem)
|
|||
return shell ? shell->GetPresContext() : nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static const nsDependentSubstring
|
||||
GetNonNegativePropValue(const nsAString& aString, nsCSSPropertyID aPropID,
|
||||
bool& aIsNegative)
|
||||
|
@ -697,6 +727,7 @@ ValueFromStringHelper(nsCSSPropertyID aPropID,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ServoAnimationValues
|
||||
ValueFromStringHelper(nsCSSPropertyID aPropID,
|
||||
|
@ -780,6 +811,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue parsedValue;
|
||||
if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
|
||||
styleContext->AsGecko(), aString, parsedValue,
|
||||
|
@ -787,6 +819,9 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
|||
sSingleton.Init(aValue);
|
||||
aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -831,11 +866,15 @@ nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
|
|||
}
|
||||
|
||||
if (wrapper->mServoValues.IsEmpty()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::UncomputeValue(wrapper->mPropID,
|
||||
wrapper->mGeckoValue,
|
||||
aString);
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (nsCSSProps::IsShorthand(wrapper->mPropID)) {
|
||||
|
@ -907,6 +946,7 @@ nsSMILCSSValueType::FinalizeValue(nsSMILValue& aValue,
|
|||
aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
|
||||
Move(zeroValues));
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const StyleAnimationValue* zeroValue =
|
||||
GetZeroValueForUnit(valueToMatchWrapper->mGeckoValue.GetUnit());
|
||||
if (!zeroValue) {
|
||||
|
@ -914,5 +954,8 @@ nsSMILCSSValueType::FinalizeValue(nsSMILValue& aValue,
|
|||
}
|
||||
aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
|
||||
*zeroValue);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
#include "nsError.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
|
@ -930,6 +932,7 @@ nsSVGElement::NodeInfoChanged(nsIDocument* aOldDoc)
|
|||
OwnerDoc()->ScheduleSVGForPresAttrEvaluation(this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -948,6 +951,7 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSVGElement::IsAttributeMapped(const nsAtom* name) const
|
||||
|
@ -1204,8 +1208,10 @@ public:
|
|||
private:
|
||||
// MEMBER DATA
|
||||
// -----------
|
||||
nsCSSParser mParser;
|
||||
css::Loader* mLoader;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser mParser;
|
||||
#endif
|
||||
|
||||
// Arguments for nsCSSParser::ParseProperty
|
||||
nsIURI* mDocURI;
|
||||
|
@ -1225,8 +1231,14 @@ MappedAttrParser::MappedAttrParser(css::Loader* aLoader,
|
|||
already_AddRefed<nsIURI> aBaseURI,
|
||||
nsSVGElement* aElement,
|
||||
StyleBackendType aBackend)
|
||||
: mParser(aLoader), mLoader(aLoader), mDocURI(aDocURI), mBaseURI(aBaseURI),
|
||||
mElement(aElement), mBackend(aBackend)
|
||||
: mLoader(aLoader)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
, mParser(aLoader)
|
||||
#endif
|
||||
, mDocURI(aDocURI)
|
||||
, mBaseURI(aBaseURI)
|
||||
, mElement(aElement)
|
||||
, mBackend(aBackend)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1243,8 +1255,12 @@ MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
|
|||
{
|
||||
if (!mDecl) {
|
||||
if (mBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mDecl = new css::Declaration();
|
||||
mDecl->AsGecko()->InitializeEmpty();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
mDecl = new ServoDeclarationBlock();
|
||||
}
|
||||
|
@ -1257,8 +1273,12 @@ MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
|
|||
if (propertyID != eCSSProperty_UNKNOWN) {
|
||||
bool changed = false; // outparam for ParseProperty.
|
||||
if (mBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
|
||||
mElement->NodePrincipal(), mDecl->AsGecko(), &changed, false, true);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
|
||||
// FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
|
||||
|
@ -1295,12 +1315,16 @@ MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
|
|||
if (aMappedAttrName == nsGkAtoms::lang) {
|
||||
propertyID = eCSSProperty__x_lang;
|
||||
if (mBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSExpandedDataBlock block;
|
||||
mDecl->AsGecko()->ExpandTo(&block);
|
||||
nsCSSValue cssValue(PromiseFlatString(aMappedAttrValue), eCSSUnit_Ident);
|
||||
block.AddLonghandProperty(propertyID, cssValue);
|
||||
mDecl->AsGecko()->ValueAppended(propertyID);
|
||||
mDecl->AsGecko()->CompressFrom(&block);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
RefPtr<nsAtom> atom = NS_Atomize(aMappedAttrValue);
|
||||
Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
|
||||
|
|
|
@ -116,8 +116,10 @@ public:
|
|||
*/
|
||||
virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
void WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
|
|
|
@ -2113,10 +2113,10 @@ nsWebBrowserPersist::CalculateUniqueFilename(nsIURI *aURI, nsCOMPtr<nsIURI>& aOu
|
|||
localFile->SetLeafName(filenameAsUnichar);
|
||||
|
||||
// Resync the URI with the file after the extension has been appended
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aURI, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
fileURL->SetFile(localFile); // this should recalculate uri
|
||||
return NS_MutateURI(aURI)
|
||||
.Apply<nsIFileURLMutator>(&nsIFileURLMutator::SetFile,
|
||||
localFile)
|
||||
.Finalize(aOutURI);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2292,9 +2292,10 @@ nsWebBrowserPersist::CalculateAndAppendFileExt(nsIURI *aURI,
|
|||
localFile->SetLeafName(NS_ConvertUTF8toUTF16(newFileName));
|
||||
|
||||
// Resync the URI with the file after the extension has been appended
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aURI, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
fileURL->SetFile(localFile); // this should recalculate uri
|
||||
return NS_MutateURI(aURI)
|
||||
.Apply<nsIFileURLMutator>(&nsIFileURLMutator::SetFile,
|
||||
localFile)
|
||||
.Finalize(aOutURI);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
/* Copyright © 2014 Deutsche Telekom, Inc. */
|
||||
|
||||
enum SEType {
|
||||
"uicc",
|
||||
"eSE"
|
||||
};
|
||||
|
||||
enum SEError {
|
||||
"SESecurityError", // Requested operation does not match the access control rules of the application.
|
||||
"SEIoError", // I/O Error while communicating with the secure element.
|
||||
"SEBadStateError", // Error occuring as a result of bad state.
|
||||
"SEInvalidChannelError", // Opening a channel failed because no channel is available.
|
||||
"SEInvalidApplicationError", // The requested application was not found on the secure element.
|
||||
"SENotPresentError", // Secure Element is not present
|
||||
"SEIllegalParameterError", // Request operation does not have valid parameters.
|
||||
"SEGenericError" // Generic failures.
|
||||
};
|
||||
|
||||
enum SEChannelType {
|
||||
"basic",
|
||||
"logical"
|
||||
};
|
||||
|
||||
// Dictionary that represents an APDU command to be sent to a secure element.
|
||||
dictionary SECommand {
|
||||
required octet cla; // Class Byte
|
||||
required octet ins; // Instruction Byte
|
||||
required octet p1; // First Octet of Parameters Byte
|
||||
required octet p2; // Second Octet of Parameters Byte
|
||||
sequence<octet>? data = null; // Sequence of octets
|
||||
short le = -1; // The length of the expected
|
||||
// response data or -1 if none is expected
|
||||
};
|
||||
|
||||
[Pref="dom.secureelement.enabled",
|
||||
ChromeOnly,
|
||||
JSImplementation="@mozilla.org/secureelement/reader;1"]
|
||||
interface SEReader {
|
||||
|
||||
// 'true' if a secure element is present
|
||||
readonly attribute boolean isSEPresent;
|
||||
|
||||
// Type of SecureElement
|
||||
readonly attribute SEType type;
|
||||
|
||||
/**
|
||||
* Opens a session with the Secure Element.
|
||||
* Note that a reader may have several opened sessions.
|
||||
*
|
||||
* @return If the operation is successful the promise is resolved with an instance of SESession.
|
||||
*/
|
||||
[Throws]
|
||||
Promise<SESession> openSession();
|
||||
|
||||
/**
|
||||
* Closes all sessions associated with this Reader and its associated channels.
|
||||
*
|
||||
*/
|
||||
[Throws]
|
||||
Promise<void> closeAll();
|
||||
};
|
||||
|
||||
[Pref="dom.secureelement.enabled",
|
||||
ChromeOnly,
|
||||
JSImplementation="@mozilla.org/secureelement/session;1"]
|
||||
interface SESession {
|
||||
|
||||
// 'reader' that provides this session
|
||||
readonly attribute SEReader reader;
|
||||
|
||||
// Status of current session
|
||||
readonly attribute boolean isClosed;
|
||||
|
||||
/**
|
||||
* Opens a communication logical channel to an application on Secure Element identified by the AID.
|
||||
* The 'aid' can be null for some secure elements.
|
||||
*
|
||||
* @param aid
|
||||
* Application Identifier of the Card Applet on the secure element.
|
||||
* If the 'aid' is null :
|
||||
* For secure element type 'eSE', the default applet is selected.
|
||||
* For secure element type 'uicc', the request will be immediately rejected.
|
||||
* Note that the length of 'aid should be between 5 and 16.
|
||||
*
|
||||
* @return If the operation is successful the promise is resolved with an instance of SEChannel.
|
||||
*/
|
||||
[Throws]
|
||||
Promise<SEChannel> openLogicalChannel(Uint8Array? aid);
|
||||
|
||||
/**
|
||||
* Close all active channels associated with this session.
|
||||
*
|
||||
*/
|
||||
[Throws]
|
||||
Promise<void> closeAll();
|
||||
};
|
||||
|
||||
[Pref="dom.secureelement.enabled",
|
||||
ChromeOnly,
|
||||
JSImplementation="@mozilla.org/secureelement/channel;1"]
|
||||
interface SEChannel {
|
||||
|
||||
// 'session' obj this channel is bound to
|
||||
readonly attribute SESession session;
|
||||
|
||||
// response to openBasicChannel / openLogicalChannel operation
|
||||
[Constant, Cached] readonly attribute Uint8Array? openResponse;
|
||||
|
||||
// Status of channel
|
||||
readonly attribute boolean isClosed;
|
||||
|
||||
// Type of channel
|
||||
readonly attribute SEChannelType type;
|
||||
|
||||
/**
|
||||
* Transmits the APDU command to the secure element. This is an atomic operation that transmits
|
||||
* an APDU command (as per ISO7816-4) to the secure element (UICC / eSE). Upon receiving response
|
||||
* to the transmit apdu command, it is propogated to the applications using SEResponse object.
|
||||
*
|
||||
* @param command
|
||||
* SECommand to be sent to secure element
|
||||
*
|
||||
* @return If success, the promise is resolved with the new created
|
||||
* SEResponse object. Otherwise, rejected with the error of type 'SEError'.
|
||||
*/
|
||||
[Throws]
|
||||
Promise<SEResponse> transmit(optional SECommand command);
|
||||
|
||||
/**
|
||||
* Closes the active channel.
|
||||
*
|
||||
*/
|
||||
[Throws]
|
||||
Promise<void> close();
|
||||
};
|
||||
|
||||
[Pref="dom.secureelement.enabled",
|
||||
ChromeOnly,
|
||||
JSImplementation="@mozilla.org/secureelement/response;1"]
|
||||
interface SEResponse {
|
||||
// Response received on this 'channel' object.
|
||||
[Constant] readonly attribute SEChannel channel;
|
||||
|
||||
// First octet of response's status word
|
||||
[Constant] readonly attribute octet sw1;
|
||||
|
||||
// Second octet of response's status word
|
||||
[Constant] readonly attribute octet sw2;
|
||||
|
||||
// The response's data field bytes
|
||||
[Cached, Pure] readonly attribute sequence<octet>? data;
|
||||
|
||||
};
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
/* Copyright © 2014 Deutsche Telekom, Inc. */
|
||||
|
||||
[Pref="dom.secureelement.enabled",
|
||||
ChromeOnly,
|
||||
JSImplementation="@mozilla.org/secureelement/manager;1",
|
||||
NavigatorProperty="seManager",
|
||||
NoInterfaceObject]
|
||||
interface SEManager {
|
||||
|
||||
/**
|
||||
* Retrieves all the readers available on the device.
|
||||
*
|
||||
* @return If success, the promise is resolved to a sequence
|
||||
* of SEReaders Otherwise, rejected with an error.
|
||||
*/
|
||||
[Throws]
|
||||
Promise<sequence<SEReader>> getSEReaders();
|
||||
};
|
|
@ -265,7 +265,7 @@ with Files("SVG*"):
|
|||
with Files("ScriptProcessorNode.webidl"):
|
||||
BUG_COMPONENT = ("Core", "Web Audio")
|
||||
|
||||
# TODO: SecureElement*, SettingChangeNotification
|
||||
# TODO: SettingChangeNotification
|
||||
# are FirefoxOS::*, leaving as Core::DOM
|
||||
|
||||
with Files("Selection.webidl"):
|
||||
|
@ -1034,12 +1034,6 @@ if CONFIG['MOZ_DEBUG']:
|
|||
'TestInterfaceJSDictionaries.webidl',
|
||||
'TestInterfaceJSMaplikeSetlikeIterable.webidl']
|
||||
|
||||
if CONFIG['MOZ_SECUREELEMENT']:
|
||||
WEBIDL_FILES += [
|
||||
'SecureElement.webidl',
|
||||
'SecureElementManager.webidl',
|
||||
]
|
||||
|
||||
WEBIDL_FILES += [
|
||||
'InstallTrigger.webidl',
|
||||
]
|
||||
|
|
|
@ -33,8 +33,10 @@
|
|||
#include "nsXBLDocumentInfo.h"
|
||||
#include "mozilla/dom/XBLChildrenElement.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
|
@ -673,6 +675,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsresult
|
||||
nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData,
|
||||
|
@ -713,6 +716,7 @@ nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsBindingManager::EnumerateBoundContentBindings(
|
||||
|
@ -743,6 +747,7 @@ nsBindingManager::EnumerateBoundContentBindings(
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData)
|
||||
|
@ -756,6 +761,7 @@ nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
|||
return true;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
||||
|
@ -786,12 +792,16 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
|||
rulesChanged = rulesChanged || styleSetChanged;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor* ruleProcessor =
|
||||
aBinding->PrototypeBinding()->GetRuleProcessor();
|
||||
if (ruleProcessor) {
|
||||
bool thisChanged = ruleProcessor->MediumFeaturesChanged(presContext);
|
||||
rulesChanged = rulesChanged || thisChanged;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -124,6 +124,7 @@ public:
|
|||
|
||||
nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Style rule methods
|
||||
nsresult WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData,
|
||||
|
@ -131,6 +132,7 @@ public:
|
|||
|
||||
void WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData);
|
||||
#endif
|
||||
|
||||
// Do any processing that needs to happen as a result of a change in the
|
||||
// characteristics of the medium, and return whether this rule processor's
|
||||
|
|
|
@ -825,6 +825,7 @@ nsXBLBinding::InheritsStyle() const
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
|
||||
{
|
||||
|
@ -835,6 +836,7 @@ nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
|
|||
if (rules)
|
||||
(*aFunc)(rules, aData);
|
||||
}
|
||||
#endif
|
||||
|
||||
ServoStyleSet*
|
||||
nsXBLBinding::GetServoStyleSet() const
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#include "nsXBLService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINodeList.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -129,7 +131,9 @@ public:
|
|||
|
||||
void ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData);
|
||||
#endif
|
||||
|
||||
mozilla::ServoStyleSet* GetServoStyleSet() const;
|
||||
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
#include "nsIInterfaceInfo.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsXBLResourceLoader.h"
|
||||
#include "mozilla/AddonPathService.h"
|
||||
#include "mozilla/dom/CDATASection.h"
|
||||
|
@ -564,6 +566,7 @@ nsXBLPrototypeBinding::SetInitialAttributes(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor*
|
||||
nsXBLPrototypeBinding::GetRuleProcessor()
|
||||
{
|
||||
|
@ -573,6 +576,7 @@ nsXBLPrototypeBinding::GetRuleProcessor()
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::ComputeServoStyleSet(nsPresContext* aPresContext)
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче