зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1416066 - Add a new flag to nsIAboutModule to load URIs in privileged content processes if feature is enabled. r=mconley
We will apply the URI_CAN_LOAD_IN_PRIVILEGED_CHILD flag to Activity Stream about: pages instead of hardcoding the URLs in a Set. MozReview-Commit-ID: F6AGmsKs1SR --HG-- extra : rebase_source : e0435776b7bd390a2a62190ba6c72d4d312538d1
This commit is contained in:
Родитель
8930e3d6fa
Коммит
01b7c92eb4
|
@ -28,6 +28,7 @@ static const uint32_t ACTIVITY_STREAM_FLAGS =
|
||||||
nsIAboutModule::ALLOW_SCRIPT |
|
nsIAboutModule::ALLOW_SCRIPT |
|
||||||
nsIAboutModule::ENABLE_INDEXED_DB |
|
nsIAboutModule::ENABLE_INDEXED_DB |
|
||||||
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
||||||
|
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGED_CHILD |
|
||||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT;
|
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT;
|
||||||
|
|
||||||
struct RedirEntry {
|
struct RedirEntry {
|
||||||
|
@ -92,6 +93,7 @@ static const RedirEntry kRedirMap[] = {
|
||||||
{ "newtab", "about:blank", ACTIVITY_STREAM_FLAGS },
|
{ "newtab", "about:blank", ACTIVITY_STREAM_FLAGS },
|
||||||
{ "welcome", "about:blank",
|
{ "welcome", "about:blank",
|
||||||
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
||||||
|
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGED_CHILD |
|
||||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||||
nsIAboutModule::ALLOW_SCRIPT },
|
nsIAboutModule::ALLOW_SCRIPT },
|
||||||
{ "library", "chrome://browser/content/aboutLibrary.xhtml",
|
{ "library", "chrome://browser/content/aboutLibrary.xhtml",
|
||||||
|
|
|
@ -10,11 +10,11 @@ interface nsIChannel;
|
||||||
interface nsILoadInfo;
|
interface nsILoadInfo;
|
||||||
|
|
||||||
[scriptable, uuid(c0c19db9-1b5a-4ac5-b656-ed6f8149fa48)]
|
[scriptable, uuid(c0c19db9-1b5a-4ac5-b656-ed6f8149fa48)]
|
||||||
interface nsIAboutModule : nsISupports
|
interface nsIAboutModule : nsISupports
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new channel for the about protocol module.
|
* Constructs a new channel for the about protocol module.
|
||||||
*
|
*
|
||||||
* @param aURI the uri of the new channel
|
* @param aURI the uri of the new channel
|
||||||
* @param aLoadInfo the loadinfo of the new channel
|
* @param aLoadInfo the loadinfo of the new channel
|
||||||
|
@ -71,6 +71,13 @@ interface nsIAboutModule : nsISupports
|
||||||
*/
|
*/
|
||||||
const unsigned long MAKE_LINKABLE = (1 << 7);
|
const unsigned long MAKE_LINKABLE = (1 << 7);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A flag that indicates that this URI can be loaded in the privileged
|
||||||
|
* content process if privileged content process is enabled. Ignored unless
|
||||||
|
* URI_MUST_LOAD_IN_CHILD is also specified.
|
||||||
|
*/
|
||||||
|
const unsigned long URI_CAN_LOAD_IN_PRIVILEGED_CHILD = (1 << 8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method to get the flags that apply to a given about: URI. The URI
|
* A method to get the flags that apply to a given about: URI. The URI
|
||||||
* passed in is guaranteed to be one of the URIs that this module
|
* passed in is guaranteed to be one of the URIs that this module
|
||||||
|
@ -81,8 +88,8 @@ interface nsIAboutModule : nsISupports
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
|
||||||
#define NS_ABOUT_MODULE_CONTRACTID "@mozilla.org/network/protocol/about;1"
|
#define NS_ABOUT_MODULE_CONTRACTID "@mozilla.org/network/protocol/about;1"
|
||||||
#define NS_ABOUT_MODULE_CONTRACTID_PREFIX NS_ABOUT_MODULE_CONTRACTID "?what="
|
#define NS_ABOUT_MODULE_CONTRACTID_PREFIX NS_ABOUT_MODULE_CONTRACTID "?what="
|
||||||
#define NS_ABOUT_MODULE_CONTRACTID_LENGTH 49 // strlen(NS_ABOUT_MODULE_CONTRACTID_PREFIX)
|
#define NS_ABOUT_MODULE_CONTRACTID_LENGTH 49 // strlen(NS_ABOUT_MODULE_CONTRACTID_PREFIX)
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -43,8 +43,6 @@ const PRIVILEGED_REMOTE_TYPE = "privileged";
|
||||||
const LARGE_ALLOCATION_REMOTE_TYPE = "webLargeAllocation";
|
const LARGE_ALLOCATION_REMOTE_TYPE = "webLargeAllocation";
|
||||||
const DEFAULT_REMOTE_TYPE = WEB_REMOTE_TYPE;
|
const DEFAULT_REMOTE_TYPE = WEB_REMOTE_TYPE;
|
||||||
|
|
||||||
const ACTIVITY_STREAM_PAGES = new Set(["home", "newtab", "welcome"]);
|
|
||||||
|
|
||||||
function validatedWebRemoteType(aPreferredRemoteType, aTargetUri, aCurrentUri) {
|
function validatedWebRemoteType(aPreferredRemoteType, aTargetUri, aCurrentUri) {
|
||||||
// If the domain is whitelisted to allow it to use file:// URIs, then we have
|
// If the domain is whitelisted to allow it to use file:// URIs, then we have
|
||||||
// to run it in a file content process, in case it uses file:// sub-resources.
|
// to run it in a file content process, in case it uses file:// sub-resources.
|
||||||
|
@ -159,9 +157,8 @@ var E10SUtils = {
|
||||||
|
|
||||||
let flags = module.getURIFlags(aURI);
|
let flags = module.getURIFlags(aURI);
|
||||||
if (flags & Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD) {
|
if (flags & Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD) {
|
||||||
// Load Activity Stream in a separate process.
|
if ((flags & Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGED_CHILD) &&
|
||||||
if (useSeparatePrivilegedContentProcess &&
|
useSeparatePrivilegedContentProcess) {
|
||||||
ACTIVITY_STREAM_PAGES.has(aURI.filePath)) {
|
|
||||||
return PRIVILEGED_REMOTE_TYPE;
|
return PRIVILEGED_REMOTE_TYPE;
|
||||||
}
|
}
|
||||||
return DEFAULT_REMOTE_TYPE;
|
return DEFAULT_REMOTE_TYPE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче