diff --git a/b2g/chrome/content/settings.js b/b2g/chrome/content/settings.js
index 49a9fc850e..8e94af6830 100644
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -6,6 +6,8 @@
"use strict";
+window.performance.mark('gecko-settings-loadstart');
+
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
diff --git a/b2g/chrome/content/shell.html b/b2g/chrome/content/shell.html
index a1941da8c2..7d2b620fc7 100644
--- a/b2g/chrome/content/shell.html
+++ b/b2g/chrome/content/shell.html
@@ -3,7 +3,7 @@
- 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/. -->
-
#endif
-
+
-#ifndef MOZ_WIDGET_GONK
+#ifndef ANDROID
diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js
index a410c1be05..b251dd25e3 100644
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -4,6 +4,8 @@
* 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/. */
+window.performance.mark('gecko-shell-loadstart');
+
Cu.import('resource://gre/modules/ContactService.jsm');
Cu.import('resource://gre/modules/DataStoreChangeNotifier.jsm');
Cu.import('resource://gre/modules/AlarmService.jsm');
@@ -73,6 +75,8 @@ XPCOMUtils.defineLazyServiceGetter(Services, 'captivePortalDetector',
'@mozilla.org/toolkit/captive-detector;1',
'nsICaptivePortalDetector');
+window.performance.measure('gecko-shell-jsm-loaded', 'gecko-shell-loadstart');
+
function getContentWindow() {
return shell.contentBrowser.contentWindow;
}
@@ -214,6 +218,12 @@ var shell = {
},
bootstrap: function() {
+#ifdef MOZ_B2GDROID
+ Cc["@mozilla.org/b2g/b2gdroid-setup;1"]
+ .getService(Ci.nsIObserver).observe(window, "shell-startup", null);
+#endif
+
+ window.performance.mark('gecko-shell-bootstrap');
let startManifestURL =
Cc['@mozilla.org/commandlinehandler/general-startup;1?type=b2gbootstrap']
.getService(Ci.nsISupports).wrappedJSObject.startManifestURL;
@@ -228,6 +238,7 @@ var shell = {
},
start: function shell_start() {
+ window.performance.mark('gecko-shell-start');
this._started = true;
// This forces the initialization of the cookie service before we hit the
@@ -347,6 +358,8 @@ var shell = {
this.contentBrowser.src = homeURL;
this.isHomeLoaded = false;
+ window.performance.mark('gecko-shell-system-frame-set');
+
ppmm.addMessageListener("content-handler", this);
ppmm.addMessageListener("dial-handler", this);
ppmm.addMessageListener("sms-handler", this);
@@ -613,6 +626,7 @@ var shell = {
},
notifyContentStart: function shell_notifyContentStart() {
+ window.performance.mark('gecko-shell-notify-content-start');
this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
this.contentBrowser.removeEventListener('mozbrowserlocationchange', this, true);
@@ -650,7 +664,28 @@ var shell = {
}
delete shell.pendingChromeEvents;
});
- }
+
+ shell.handleCmdLine();
+ },
+
+ handleCmdLine: function shell_handleCmdLine() {
+ // This isn't supported on devices.
+#ifndef ANDROID
+ let b2gcmds = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"]
+ .getService(Ci.nsISupports);
+ let args = b2gcmds.wrappedJSObject.cmdLine;
+ try {
+ // Returns null if -url is not present
+ let url = args.handleFlagWithParam("url", false);
+ if (url) {
+ this.sendChromeEvent({type: "mozbrowseropenwindow", url});
+ args.preventDefault = true;
+ }
+ } catch(e) {
+ // Throws if -url is present with no params
+ }
+#endif
+ },
};
Services.obs.addObserver(function onFullscreenOriginChange(subject, topic, data) {
@@ -905,6 +940,7 @@ window.addEventListener('ContentStart', function update_onContentStart() {
Cu.import('resource://gre/modules/WebappsUpdater.jsm');
WebappsUpdater.handleContentStart(shell);
+#ifdef MOZ_UPDATER
let promptCc = Cc["@mozilla.org/updates/update-prompt;1"];
if (!promptCc) {
return;
@@ -916,6 +952,7 @@ window.addEventListener('ContentStart', function update_onContentStart() {
}
updatePrompt.wrappedJSObject.handleContentStart(shell);
+#endif
});
(function geolocationStatusTracker() {
diff --git a/b2g/components/B2GComponents.manifest b/b2g/components/B2GComponents.manifest
index 9f2ca1141a..f670b53f59 100644
--- a/b2g/components/B2GComponents.manifest
+++ b/b2g/components/B2GComponents.manifest
@@ -16,10 +16,15 @@ contract @mozilla.org/updates/update-prompt;1 {88b3eb21-d072-4e3b-886d-f89d8c49f
category system-update-provider MozillaProvider @mozilla.org/updates/update-prompt;1,{88b3eb21-d072-4e3b-886d-f89d8c49fe59}
#endif
+# On b2gdroid we want to use the android implementation of the directory service.
+#ifndef MOZ_B2GDROID
+#ifdef MOZ_B2G
# DirectoryProvider.js
component {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5} DirectoryProvider.js
contract @mozilla.org/b2g/directory-provider;1 {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5}
category xpcom-directory-providers b2g-directory-provider @mozilla.org/b2g/directory-provider;1
+#endif
+#endif
# ActivitiesGlue.js
component {3a54788b-48cc-4ab4-93d6-0d6a8ef74f8e} ActivitiesGlue.js
@@ -87,6 +92,7 @@ contract @mozilla.org/fxaccounts/fxaccounts-ui-glue;1 {51875c14-91d7-4b8c-b65d-3
component {710322af-e6ae-4b0c-b2c9-1474a87b077e} HelperAppDialog.js
contract @mozilla.org/helperapplauncherdialog;1 {710322af-e6ae-4b0c-b2c9-1474a87b077e}
+#ifndef MOZ_B2GDROID
#ifndef MOZ_WIDGET_GONK
component {c83c02c0-5d43-4e3e-987f-9173b313e880} SimulatorScreen.js
contract @mozilla.org/simulator-screen;1 {c83c02c0-5d43-4e3e-987f-9173b313e880}
@@ -100,6 +106,7 @@ component {385993fe-8710-4621-9fb1-00a09d8bec37} CommandLine.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds {385993fe-8710-4621-9fb1-00a09d8bec37}
category command-line-handler m-b2gcmds @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds
#endif
+#endif
# BootstrapCommandLine.js
component {fd663ec8-cf3f-4c2b-aacb-17a6915ccb44} BootstrapCommandLine.js
diff --git a/b2g/components/CommandLine.js b/b2g/components/CommandLine.js
index bdb1221e8b..6dc48bd338 100644
--- a/b2g/components/CommandLine.js
+++ b/b2g/components/CommandLine.js
@@ -15,6 +15,10 @@ function CommandlineHandler() {
CommandlineHandler.prototype = {
handle: function(cmdLine) {
this.cmdLine = cmdLine;
+ let win = Services.wm.getMostRecentWindow("navigator:browser");
+ if (win && win.shell) {
+ win.shell.handleCmdLine();
+ }
},
helpInfo: "",
diff --git a/b2g/components/DirectoryProvider.js b/b2g/components/DirectoryProvider.js
index 58eb8b4c4f..196bf67a51 100644
--- a/b2g/components/DirectoryProvider.js
+++ b/b2g/components/DirectoryProvider.js
@@ -15,6 +15,7 @@ const UPDATE_ARCHIVE_DIR = "UpdArchD"
const LOCAL_DIR = "/data/local";
const UPDATES_DIR = "updates/0";
const FOTA_DIR = "updates/fota";
+const COREAPPSDIR_PREF = "b2g.coreappsdir"
XPCOMUtils.defineLazyServiceGetter(Services, "env",
"@mozilla.org/process/environment;1",
@@ -97,12 +98,27 @@ DirectoryProvider.prototype = {
return this.getUpdateDir(persistent, FOTA_DIR, 1.1);
}
#else
- // In desktop builds, coreAppsDir is the same as the profile directory.
- // We just need to get the path from the parent, and it is then used to
- // build jar:remoteopenfile:// uris.
+ // In desktop builds, coreAppsDir is the same as the profile
+ // directory unless otherwise specified. We just need to get the
+ // path from the parent, and it is then used to build
+ // jar:remoteopenfile:// uris.
if (prop == "coreAppsDir") {
- let appsDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
- appsDir.append("webapps");
+ let coreAppsDirPref;
+ try {
+ coreAppsDirPref = Services.prefs.getCharPref(COREAPPSDIR_PREF);
+ } catch (e) {
+ // coreAppsDirPref may not exist if we're on an older version
+ // of gaia, so just fail silently.
+ }
+ let appsDir;
+ // If pref doesn't exist or isn't set, default to old value
+ if (!coreAppsDirPref || coreAppsDirPref == "") {
+ appsDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ appsDir.append("webapps");
+ } else {
+ appsDir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile)
+ appsDir.initWithPath(coreAppsDirPref);
+ }
persistent.value = true;
return appsDir;
} else if (prop == "ProfD") {
diff --git a/b2g/components/moz.build b/b2g/components/moz.build
index 07a7943708..5e0c0be112 100644
--- a/b2g/components/moz.build
+++ b/b2g/components/moz.build
@@ -31,7 +31,7 @@ EXTRA_COMPONENTS += [
'WebappsUpdateTimer.js',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
+if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
EXTRA_COMPONENTS += [
'CommandLine.js',
'OopCommandLine.js',
@@ -40,10 +40,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
EXTRA_PP_COMPONENTS += [
'B2GComponents.manifest',
- 'DirectoryProvider.js',
- 'RecoveryService.js',
]
+if CONFIG['MOZ_B2G'] and not CONFIG['MOZ_B2GDROID']:
+ EXTRA_PP_COMPONENTS += [
+ 'DirectoryProvider.js',
+ 'RecoveryService.js',
+ ]
+
if CONFIG['MOZ_UPDATER']:
EXTRA_PP_COMPONENTS += [
'UpdatePrompt.js',
diff --git a/build/pgo/certs/cert8.db b/build/pgo/certs/cert8.db
index 2835ad3470..3f2ef8379e 100644
Binary files a/build/pgo/certs/cert8.db and b/build/pgo/certs/cert8.db differ
diff --git a/build/pgo/certs/key3.db b/build/pgo/certs/key3.db
index ae47698b30..6a9f398833 100644
Binary files a/build/pgo/certs/key3.db and b/build/pgo/certs/key3.db differ
diff --git a/build/pgo/server-locations.txt b/build/pgo/server-locations.txt
index d82c6d4333..da4c66e411 100644
--- a/build/pgo/server-locations.txt
+++ b/build/pgo/server-locations.txt
@@ -95,10 +95,14 @@ http://example.net:80 privileged
# Used to test that clearing Service Workers for domain example.com, does not clear prefixexample.com
http://prefixexample.com:80
+# The first HTTPS location is used to generate the Common Name (CN) value of the
+# certificate's Issued To field.
https://example.com:443 privileged
-https://example.org:443 privileged
https://test1.example.com:443 privileged
https://test2.example.com:443 privileged
+https://example.org:443 privileged
+https://test1.example.org:443 privileged
+https://test2.example.org:443 privileged
https://sub1.test1.example.com:443 privileged
https://sub1.test2.example.com:443 privileged
https://sub2.test1.example.com:443 privileged
@@ -168,6 +172,11 @@ http://tracking.example.com:80
http://not-tracking.example.com:80
http://tracking.example.org:80
+https://malware.example.com:443
+https://tracking.example.com:443
+https://not-tracking.example.com:443
+https://tracking.example.org:443
+
# Bug 483437, 484111
https://www.bank1.com:443 privileged,cert=escapeattack1
diff --git a/configure.in b/configure.in
index fbe4bdb9ff..2f4a1af5ac 100644
--- a/configure.in
+++ b/configure.in
@@ -4003,6 +4003,10 @@ b2g/dev)
;;
esac
+if test -n "$MOZ_B2GDROID"; then
+ AC_DEFINE(MOZ_B2GDROID)
+fi
+
AC_SUBST(MOZ_BUILD_APP)
AC_SUBST(MOZ_PHOENIX)
AC_SUBST(MOZ_XULRUNNER)
diff --git a/dom/apps/Webapps.js b/dom/apps/Webapps.js
index aa712163cc..e46e99966d 100644
--- a/dom/apps/Webapps.js
+++ b/dom/apps/Webapps.js
@@ -316,7 +316,7 @@ WebappsRegistry.prototype = {
}
this.addMessageListeners(["Webapps:GetLocalizationResource:Return"]);
- return this.createPromise((aResolve, aReject) => {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetLocalizationResource", {
manifestURL: manifestURL,
lang: aLanguage,
@@ -325,10 +325,7 @@ WebappsRegistry.prototype = {
dataType: aType,
oid: this._id,
topId: this._topId,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })
+ requestID: aResolverId
});
});
},
@@ -609,7 +606,7 @@ WebappsApplication.prototype = {
connect: function(aKeyword, aRules) {
this.addMessageListeners(["Webapps:Connect:Return:OK",
"Webapps:Connect:Return:KO"]);
- return this.createPromise(function (aResolve, aReject) {
+ return this.createPromiseWithId((aResolverId) => {
let from = this._window.location.origin + this._window.location.pathname;
cpmm.sendAsyncMessage("Webapps:Connect", {
keyword: aKeyword,
@@ -618,27 +615,21 @@ WebappsApplication.prototype = {
pubPageURL: from,
outerWindowID: this._id,
topWindowID: this._topId,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })
+ requestID: aResolverId
});
- }.bind(this));
+ });
},
getConnections: function() {
this.addMessageListeners("Webapps:GetConnections:Return:OK");
- return this.createPromise(function (aResolve, aReject) {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetConnections", {
manifestURL: this.manifestURL,
outerWindowID: this._id,
topWindowID: this._topId,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })
+ requestID: aResolverId
});
- }.bind(this));
+ });
},
addReceipt: function(receipt) {
@@ -689,22 +680,19 @@ WebappsApplication.prototype = {
export: function() {
this.addMessageListeners(["Webapps:Export:Return"]);
- return this.createPromise((aResolve, aReject) => {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:Export",
{ manifestURL: this.manifestURL,
oid: this._id,
topId: this._topId,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })
+ requestID: aResolverId
});
});
},
getLocalizedValue: function(aProperty, aLang, aEntryPoint) {
this.addMessageListeners(["Webapps:GetLocalizedValue:Return"]);
- return this.createPromise((aResolve, aReject) => {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetLocalizedValue",
{ manifestURL: this.manifestURL,
oid: this._id,
@@ -712,10 +700,7 @@ WebappsApplication.prototype = {
property: aProperty,
lang: aLang,
entryPoint: aEntryPoint,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })
+ requestID: aResolverId
});
});
},
@@ -958,19 +943,16 @@ WebappsApplicationMgmt.prototype = {
},
getIcon: function(aApp, aIconID, aEntryPoint) {
- return this.createPromise(function(aResolve, aReject) {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetIcon", {
oid: this._id,
topId: this._topId,
manifestURL: aApp.manifestURL,
iconID: aIconID,
entryPoint: aEntryPoint,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })
+ requestID: aResolverId
});
- }.bind(this));
+ });
},
getNotInstalled: function() {
@@ -988,29 +970,25 @@ WebappsApplicationMgmt.prototype = {
import: function(aBlob) {
let principal = this._window.document.nodePrincipal;
- return this.createPromise((aResolve, aReject) => {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:Import",
{ blob: aBlob,
oid: this._id,
topId: this._topId,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })}, null, principal);
+ requestID: aResolverId
+ }, null, principal);
});
},
extractManifest: function(aBlob) {
let principal = this._window.document.nodePrincipal;
- return this.createPromise((aResolve, aReject) => {
+ return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:ExtractManifest",
{ blob: aBlob,
oid: this._id,
topId: this._topId,
- requestID: this.getPromiseResolverId({
- resolve: aResolve,
- reject: aReject
- })}, null, principal);
+ requestID: aResolverId
+ }, null, principal);
});
},
diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm
index 18d9785f83..187362ae7a 100755
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -85,6 +85,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Langpacks",
XPCOMUtils.defineLazyModuleGetter(this, "ImportExport",
"resource://gre/modules/ImportExport.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+ "resource://gre/modules/AppConstants.jsm");
+
#ifdef MOZ_WIDGET_GONK
XPCOMUtils.defineLazyGetter(this, "libcutils", function() {
Cu.import("resource://gre/modules/systemlibs.js");
@@ -774,9 +777,9 @@ this.DOMApplicationRegistry = {
}
}
-#ifdef MOZ_WIDGET_GONK
- yield this.installSystemApps();
-#endif
+ if (AppConstants.MOZ_B2GDROID || AppConstants.MOZ_B2G) {
+ yield this.installSystemApps();
+ }
// At first run, install preloaded apps and set up their permissions.
for (let id in this.webapps) {
@@ -851,8 +854,16 @@ this.DOMApplicationRegistry = {
root = aManifest.entry_points[aEntryPoint];
}
- if (!root.messages || !Array.isArray(root.messages) ||
- root.messages.length == 0) {
+ if (!root.messages) {
+ // This application just doesn't use system messages.
+ return;
+ }
+
+ if (!Array.isArray(root.messages) || root.messages.length == 0) {
+ dump("Could not register invalid system message entry for " + aApp.manifestURL + "\n");
+ try {
+ dump(JSON.stringify(root.messages) + "\n");
+ } catch(e) {}
return;
}
@@ -862,28 +873,32 @@ this.DOMApplicationRegistry = {
root.messages.forEach(function registerPages(aMessage) {
let handlerPageURI = launchPathURI;
let messageName;
- if (typeof(aMessage) === "object" && Object.keys(aMessage).length === 1) {
- messageName = Object.keys(aMessage)[0];
- let handlerPath = aMessage[messageName];
- // Resolve the handler path from origin. If |handler_path| is absent,
- // simply skip.
- let fullHandlerPath;
+ if (typeof(aMessage) !== "object" || Object.keys(aMessage).length !== 1) {
+ dump("Could not register invalid system message entry for " + aApp.manifestURL + "\n");
try {
- if (handlerPath && handlerPath.trim()) {
- fullHandlerPath = manifest.resolveURL(handlerPath);
- } else {
- throw new Error("Empty or blank handler path.");
- }
- } catch(e) {
- debug("system message handler path (" + handlerPath + ") is " +
- "invalid, skipping. Error is: " + e);
- return;
- }
- handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
- } else {
- messageName = aMessage;
+ dump(JSON.stringify(aMessage) + "\n");
+ } catch(e) {}
+ return;
}
+ messageName = Object.keys(aMessage)[0];
+ let handlerPath = aMessage[messageName];
+ // Resolve the handler path from origin. If |handler_path| is absent,
+ // simply skip.
+ let fullHandlerPath;
+ try {
+ if (handlerPath && handlerPath.trim()) {
+ fullHandlerPath = manifest.resolveURL(handlerPath);
+ } else {
+ throw new Error("Empty or blank handler path.");
+ }
+ } catch(e) {
+ debug("system message handler path (" + handlerPath + ") is " +
+ "invalid, skipping. Error is: " + e);
+ return;
+ }
+ handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
+
if (SystemMessagePermissionsChecker
.isSystemMessagePermittedToRegister(messageName,
aApp.manifestURL,
@@ -2939,6 +2954,12 @@ this.DOMApplicationRegistry = {
// don't update the permissions yet.
if (!aData.isPackage) {
if (supportUseCurrentProfile()) {
+ try {
+ if (Services.prefs.getBoolPref("dom.apps.developer_mode")) {
+ this.webapps[id].appStatus =
+ AppsUtils.getAppManifestStatus(app.manifest);
+ }
+ } catch(e) {};
PermissionsInstaller.installPermissions(
{
origin: appObject.origin,
diff --git a/dom/base/DOMRequestHelper.jsm b/dom/base/DOMRequestHelper.jsm
index 5c51dce998..3d594872cb 100644
--- a/dom/base/DOMRequestHelper.jsm
+++ b/dom/base/DOMRequestHelper.jsm
@@ -298,6 +298,17 @@ DOMRequestIpcHelper.prototype = {
return new this._window.Promise(aPromiseInit);
},
+ /**
+ * createPromiseWithId() creates a new Promise, accepting a callback
+ * which is immediately called with the generated resolverId.
+ */
+ createPromiseWithId: function(aCallback) {
+ return this.createPromise(function(aResolve, aReject) {
+ let resolverId = this.getPromiseResolverId({ resolve: aResolve, reject: aReject });
+ aCallback(resolverId);
+ }.bind(this));
+ },
+
forEachRequest: function(aCallback) {
if (!this._requests) {
return;
diff --git a/dom/base/nsContentPolicyUtils.h b/dom/base/nsContentPolicyUtils.h
index 3b4ae32b9e..6a8535fc5c 100644
--- a/dom/base/nsContentPolicyUtils.h
+++ b/dom/base/nsContentPolicyUtils.h
@@ -93,41 +93,46 @@ inline const char *
NS_CP_ContentTypeName(uint32_t contentType)
{
switch (contentType) {
- CASE_RETURN( TYPE_OTHER );
- CASE_RETURN( TYPE_SCRIPT );
- CASE_RETURN( TYPE_IMAGE );
- CASE_RETURN( TYPE_STYLESHEET );
- CASE_RETURN( TYPE_OBJECT );
- CASE_RETURN( TYPE_DOCUMENT );
- CASE_RETURN( TYPE_SUBDOCUMENT );
- CASE_RETURN( TYPE_REFRESH );
- CASE_RETURN( TYPE_XBL );
- CASE_RETURN( TYPE_PING );
- CASE_RETURN( TYPE_XMLHTTPREQUEST );
- CASE_RETURN( TYPE_OBJECT_SUBREQUEST );
- CASE_RETURN( TYPE_DTD );
- CASE_RETURN( TYPE_FONT );
- CASE_RETURN( TYPE_MEDIA );
- CASE_RETURN( TYPE_WEBSOCKET );
- CASE_RETURN( TYPE_CSP_REPORT );
- CASE_RETURN( TYPE_XSLT );
- CASE_RETURN( TYPE_BEACON );
- CASE_RETURN( TYPE_FETCH );
- CASE_RETURN( TYPE_IMAGESET );
- CASE_RETURN( TYPE_WEB_MANIFEST );
- CASE_RETURN( TYPE_INTERNAL_SCRIPT );
- CASE_RETURN( TYPE_INTERNAL_WORKER );
- CASE_RETURN( TYPE_INTERNAL_SHARED_WORKER );
- CASE_RETURN( TYPE_INTERNAL_EMBED );
- CASE_RETURN( TYPE_INTERNAL_OBJECT );
- CASE_RETURN( TYPE_INTERNAL_FRAME );
- CASE_RETURN( TYPE_INTERNAL_IFRAME );
- CASE_RETURN( TYPE_INTERNAL_AUDIO );
- CASE_RETURN( TYPE_INTERNAL_VIDEO );
- CASE_RETURN( TYPE_INTERNAL_TRACK );
- CASE_RETURN( TYPE_INTERNAL_XMLHTTPREQUEST );
- CASE_RETURN( TYPE_INTERNAL_EVENTSOURCE );
- CASE_RETURN( TYPE_INTERNAL_SERVICE_WORKER );
+ CASE_RETURN( TYPE_OTHER );
+ CASE_RETURN( TYPE_SCRIPT );
+ CASE_RETURN( TYPE_IMAGE );
+ CASE_RETURN( TYPE_STYLESHEET );
+ CASE_RETURN( TYPE_OBJECT );
+ CASE_RETURN( TYPE_DOCUMENT );
+ CASE_RETURN( TYPE_SUBDOCUMENT );
+ CASE_RETURN( TYPE_REFRESH );
+ CASE_RETURN( TYPE_XBL );
+ CASE_RETURN( TYPE_PING );
+ CASE_RETURN( TYPE_XMLHTTPREQUEST );
+ CASE_RETURN( TYPE_OBJECT_SUBREQUEST );
+ CASE_RETURN( TYPE_DTD );
+ CASE_RETURN( TYPE_FONT );
+ CASE_RETURN( TYPE_MEDIA );
+ CASE_RETURN( TYPE_WEBSOCKET );
+ CASE_RETURN( TYPE_CSP_REPORT );
+ CASE_RETURN( TYPE_XSLT );
+ CASE_RETURN( TYPE_BEACON );
+ CASE_RETURN( TYPE_FETCH );
+ CASE_RETURN( TYPE_IMAGESET );
+ CASE_RETURN( TYPE_WEB_MANIFEST );
+ CASE_RETURN( TYPE_INTERNAL_SCRIPT );
+ CASE_RETURN( TYPE_INTERNAL_WORKER );
+ CASE_RETURN( TYPE_INTERNAL_SHARED_WORKER );
+ CASE_RETURN( TYPE_INTERNAL_EMBED );
+ CASE_RETURN( TYPE_INTERNAL_OBJECT );
+ CASE_RETURN( TYPE_INTERNAL_FRAME );
+ CASE_RETURN( TYPE_INTERNAL_IFRAME );
+ CASE_RETURN( TYPE_INTERNAL_AUDIO );
+ CASE_RETURN( TYPE_INTERNAL_VIDEO );
+ CASE_RETURN( TYPE_INTERNAL_TRACK );
+ CASE_RETURN( TYPE_INTERNAL_XMLHTTPREQUEST );
+ CASE_RETURN( TYPE_INTERNAL_EVENTSOURCE );
+ CASE_RETURN( TYPE_INTERNAL_SERVICE_WORKER );
+ CASE_RETURN( TYPE_INTERNAL_SCRIPT_PRELOAD );
+ CASE_RETURN( TYPE_INTERNAL_IMAGE );
+ CASE_RETURN( TYPE_INTERNAL_IMAGE_PRELOAD );
+ CASE_RETURN( TYPE_INTERNAL_STYLESHEET );
+ CASE_RETURN( TYPE_INTERNAL_STYLESHEET_PRELOAD );
default:
return "";
}
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index 5ca978b96a..5c56d6737b 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -95,7 +95,6 @@
#include "nsHostObjectProtocolHandler.h"
#include "nsHtml5Module.h"
#include "nsHtml5StringParser.h"
-#include "nsIAppShell.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsICategoryManager.h"
#include "nsIChannelEventSink.h"
@@ -357,7 +356,6 @@ namespace {
static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
-static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
static PLDHashTable* sEventListenerManagersHash;
@@ -5266,7 +5264,6 @@ nsContentUtils::LeaveMicroTask()
MOZ_ASSERT(NS_IsMainThread());
if (--sMicroTaskLevel == 0) {
PerformMainThreadMicroTaskCheckpoint();
- nsDocument::ProcessBaseElementQueue();
}
}
@@ -7173,7 +7170,7 @@ nsContentUtils::IsForbiddenSystemRequestHeader(const nsACString& aHeader)
"access-control-request-method", "connection", "content-length",
"cookie", "cookie2", "content-transfer-encoding", "date", "dnt",
"expect", "host", "keep-alive", "origin", "referer", "te", "trailer",
- "transfer-encoding", "upgrade", "user-agent", "via"
+ "transfer-encoding", "upgrade", "via"
};
for (uint32_t i = 0; i < ArrayLength(kInvalidHeaders); ++i) {
if (aHeader.LowerCaseEqualsASCII(kInvalidHeaders[i])) {
@@ -7972,13 +7969,13 @@ nsContentUtils::GetWindowRoot(nsIDocument* aDoc)
return nullptr;
}
-
/* static */
nsContentPolicyType
nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType)
{
switch (aType) {
case nsIContentPolicy::TYPE_INTERNAL_SCRIPT:
+ case nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD:
case nsIContentPolicy::TYPE_INTERNAL_WORKER:
case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
@@ -8001,6 +7998,14 @@ nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType)
case nsIContentPolicy::TYPE_INTERNAL_EVENTSOURCE:
return nsIContentPolicy::TYPE_XMLHTTPREQUEST;
+ case nsIContentPolicy::TYPE_INTERNAL_IMAGE:
+ case nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD:
+ return nsIContentPolicy::TYPE_IMAGE;
+
+ case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET:
+ case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD:
+ return nsIContentPolicy::TYPE_STYLESHEET;
+
default:
return aType;
}
@@ -8211,28 +8216,17 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
access = std::min(StorageAccess::eSessionScoped, access);
}
- // If the caller is chrome privileged, then it is allowed to access any
- // storage it likes, no matter whether the storage for that window/principal
- // would normally be permitted.
- if (IsSystemPrincipal(SubjectPrincipal())) {
- return access;
- }
-
- if (!SubjectPrincipal()->Subsumes(aPrincipal)) {
- NS_WARNING("A principal is attempting to access storage for a principal "
- "which it doesn't subsume!");
- return StorageAccess::eDeny;
- }
-
// About URIs are allowed to access storage, even if they don't have chrome
// privileges. If this is not desired, than the consumer will have to
// implement their own restriction functionality.
nsCOMPtr uri;
- MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetURI(getter_AddRefs(uri))));
- bool isAbout = false;
- MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)));
- if (isAbout) {
- return access;
+ nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
+ if (NS_SUCCEEDED(rv) && uri) {
+ bool isAbout = false;
+ MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)));
+ if (isAbout) {
+ return access;
+ }
}
nsCOMPtr permissionManager =
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index 63ea62c8cd..ed343cdc18 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5915,29 +5915,6 @@ nsDocument::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName)
return NS_OK;
}
-namespace {
-
-class ProcessStackRunner final : public nsIRunnable
-{
- ~ProcessStackRunner() {}
-public:
- explicit ProcessStackRunner(bool aIsBaseQueue = false)
- : mIsBaseQueue(aIsBaseQueue)
- {
- }
- NS_DECL_ISUPPORTS
- NS_IMETHOD Run() override
- {
- nsDocument::ProcessTopElementQueue(mIsBaseQueue);
- return NS_OK;
- }
- bool mIsBaseQueue;
-};
-
-NS_IMPL_ISUPPORTS(ProcessStackRunner, nsIRunnable);
-
-} // namespace
-
void
nsDocument::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
@@ -6039,10 +6016,7 @@ nsDocument::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
// A new element queue needs to be pushed if the queue at the
// top of the stack is associated with another microtask level.
- // Don't push a queue for the level 0 microtask (base element queue)
- // because we don't want to process the queue until the
- // microtask checkpoint.
- bool shouldPushElementQueue = nsContentUtils::MicroTaskLevel() > 0 &&
+ bool shouldPushElementQueue =
(!lastData || lastData->mAssociatedMicroTask <
static_cast(nsContentUtils::MicroTaskLevel()));
@@ -6065,39 +6039,22 @@ nsDocument::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
// should be invoked prior to returning control back to script.
// Create a script runner to process the top of the processing
// stack as soon as it is safe to run script.
- nsContentUtils::AddScriptRunner(new ProcessStackRunner());
+ nsCOMPtr runnable =
+ NS_NewRunnableFunction(&nsDocument::ProcessTopElementQueue);
+ nsContentUtils::AddScriptRunner(runnable);
}
}
}
// static
void
-nsDocument::ProcessBaseElementQueue()
-{
- // Prevent re-entrance. Also, if a microtask checkpoint is reached
- // and there is no processing stack to process, then we are done.
- if (sProcessingBaseElementQueue || !sProcessingStack) {
- return;
- }
-
- MOZ_ASSERT(nsContentUtils::MicroTaskLevel() == 0);
- sProcessingBaseElementQueue = true;
- nsContentUtils::AddScriptRunner(new ProcessStackRunner(true));
-}
-
-// static
-void
-nsDocument::ProcessTopElementQueue(bool aIsBaseQueue)
+nsDocument::ProcessTopElementQueue()
{
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
nsTArray>& stack = *sProcessingStack;
uint32_t firstQueue = stack.LastIndexOf((CustomElementData*) nullptr);
- if (aIsBaseQueue && firstQueue != 0) {
- return;
- }
-
for (uint32_t i = firstQueue + 1; i < stack.Length(); ++i) {
// Callback queue may have already been processed in an earlier
// element queue or in an element queue that was popped
@@ -6115,7 +6072,6 @@ nsDocument::ProcessTopElementQueue(bool aIsBaseQueue)
} else {
// Don't pop sentinel for base element queue.
stack.SetLength(1);
- sProcessingBaseElementQueue = false;
}
}
@@ -6131,10 +6087,6 @@ nsDocument::RegisterEnabled()
Maybe>>
nsDocument::sProcessingStack;
-// static
-bool
-nsDocument::sProcessingBaseElementQueue;
-
void
nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
const ElementRegistrationOptions& aOptions,
@@ -8594,9 +8546,6 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
// The misspelled key 'referer' is as per the HTTP spec
rv = httpChannel->GetRequestHeader(NS_LITERAL_CSTRING("referer"),
mReferrer);
- if (NS_FAILED(rv)) {
- mReferrer.Truncate();
- }
static const char *const headers[] = {
"default-style",
@@ -9907,7 +9856,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset,
nsCOMPtr obs = new StubCSSLoaderObserver();
// Charset names are always ASCII.
- CSSLoader()->LoadSheet(uri, NodePrincipal(),
+ CSSLoader()->LoadSheet(uri, true, NodePrincipal(),
NS_LossyConvertUTF16toASCII(charset),
obs,
Element::StringToCORSMode(aCrossOriginAttr),
diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h
index 4bd77b27d3..96670d6a32 100644
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -1296,7 +1296,7 @@ public:
mozilla::dom::LifecycleCallbackArgs* aArgs = nullptr,
mozilla::dom::CustomElementDefinition* aDefinition = nullptr) override;
- static void ProcessTopElementQueue(bool aIsBaseQueue = false);
+ static void ProcessTopElementQueue();
void GetCustomPrototype(int32_t aNamespaceID,
nsIAtom* aAtom,
@@ -1584,15 +1584,9 @@ private:
// queue in the stack is the base element queue.
static mozilla::Maybe>> sProcessingStack;
- // Flag to prevent re-entrance into base element queue as described in the
- // custom elements speicification.
- static bool sProcessingBaseElementQueue;
-
static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
public:
- static void ProcessBaseElementQueue();
-
// Enqueue created callback or register upgrade candidate for
// newly created custom elements, possibly extending an existing type.
// ex. ,