Backing out 580a54390e83 from bug 1083281 due to devtools test failures. CLOSED TREE

--HG--
extra : amend_source : fbfc679388087db7356da23e1d72c4edee1b3ec1
This commit is contained in:
Dave Townsend 2015-02-03 15:51:24 -08:00
Родитель 7d11ca69ff
Коммит cca2c56915
24 изменённых файлов: 116 добавлений и 526 удалений

Просмотреть файл

@ -823,12 +823,10 @@ function _loadURIWithFlags(browser, uri, flags, referrer, charset, postdata) {
browser.userTypedClear++;
}
let process = browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
: Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
let mustChangeProcess = gMultiProcessBrowser &&
!E10SUtils.canLoadURIInProcess(uri, process);
let shouldBeRemote = gMultiProcessBrowser &&
E10SUtils.shouldBrowserBeRemote(uri);
try {
if (!mustChangeProcess) {
if (browser.isRemoteBrowser == shouldBeRemote) {
browser.webNavigation.loadURI(uri, flags, referrer, postdata, null);
} else {
LoadInOtherProcess(browser, {
@ -842,7 +840,7 @@ function _loadURIWithFlags(browser, uri, flags, referrer, charset, postdata) {
// We might lose history that way but at least the browser loaded a page.
// This might be necessary if SessionStore wasn't initialized yet i.e.
// when the homepage is a non-remote page.
gBrowser.updateBrowserRemotenessByURL(browser, uri);
gBrowser.updateBrowserRemoteness(browser, shouldBeRemote);
browser.webNavigation.loadURI(uri, flags, referrer, postdata, null);
} finally {
if (browser.userTypedClear) {

Просмотреть файл

@ -1514,18 +1514,9 @@
<parameter name="aURL"/>
<body>
<![CDATA[
if (!gMultiProcessBrowser)
return this.updateBrowserRemoteness(aBrowser, false);
let process = aBrowser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
: Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
// If this URL can't load in the browser's current process then flip
// it to the other process
if (!E10SUtils.canLoadURIInProcess(aURL, process))
return this.updateBrowserRemoteness(aBrowser, !aBrowser.isRemoteBrowser);
return false;
let shouldBeRemote = gMultiProcessBrowser &&
E10SUtils.shouldBrowserBeRemote(aURL);
return this.updateBrowserRemoteness(aBrowser, shouldBeRemote);
]]>
</body>
</method>
@ -1699,10 +1690,7 @@
t.setAttribute("onerror", "this.removeAttribute('image');");
t.className = "tabbrowser-tab";
// The new browser should be remote if this is an e10s window and
// the uri to load can be loaded remotely.
let remote = gMultiProcessBrowser &&
E10SUtils.canLoadURIInProcess(aURI, Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT);
let remote = gMultiProcessBrowser && E10SUtils.shouldBrowserBeRemote(aURI);
if (remote)
t.setAttribute("remote", "true");

Просмотреть файл

@ -79,7 +79,6 @@ support-files =
test_bug628179.html
test_bug839103.html
test_bug959531.html
test_process_flags_chrome.html
test_wyciwyg_copying.html
title_test.svg
video.ogg
@ -481,8 +480,6 @@ skip-if = e10s
skip-if = e10s # Bug 1100687 - test directly manipulates content (content.document.getElementById)
[browser_bug1045809.js]
[browser_e10s_switchbrowser.js]
[browser_e10s_about_process.js]
[browser_e10s_chrome_process.js]
[browser_blockHPKP.js]
skip-if = e10s # bug 1100687 - test directly manipulates content (content.document.getElementById)
[browser_mcb_redirect.js]

Просмотреть файл

@ -217,10 +217,10 @@ let gTests = [
yield OS.File.writeAtomic(fxAccountsStorage, JSON.stringify(signedInUser));
info("Wrote file " + fxAccountsStorage);
// this is a little subtle - we load about:robots so we get a non-remote
// tab, then we send a message which does both (a) load the URL we want and
// (b) mocks the default profile path used by about:accounts.
let tab = yield promiseNewTabLoadEvent("about:robots");
// this is a little subtle - we load about:blank so we get a tab, then
// we send a message which does both (a) load the URL we want and (b) mocks
// the default profile path used by about:accounts.
let tab = yield promiseNewTabLoadEvent("about:blank?");
let readyPromise = promiseOneMessage(tab, "test:load-with-mocked-profile-path-response");
let mm = tab.linkedBrowser.messageManager;
@ -261,7 +261,7 @@ let gTests = [
mockDir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
// but leave it empty, so we don't think a user is logged in.
let tab = yield promiseNewTabLoadEvent("about:robots");
let tab = yield promiseNewTabLoadEvent("about:blank?");
let readyPromise = promiseOneMessage(tab, "test:load-with-mocked-profile-path-response");
let mm = tab.linkedBrowser.messageManager;

Просмотреть файл

@ -13,13 +13,8 @@ add_task(function test_ignoreFragment() {
switchTab("about:home#1", true);
switchTab("about:mozilla", true);
let hashChangePromise = new Promise(resolve => {
tabRefAboutHome.linkedBrowser.contentWindow.addEventListener("hashchange", resolve, false);
});
switchTab("about:home#2", true, { ignoreFragment: true });
is(tabRefAboutHome, gBrowser.selectedTab, "The same about:home tab should be switched to");
yield hashChangePromise;
is(gBrowser.currentURI.ref, "2", "The ref should be updated to the new ref");
switchTab("about:mozilla", true);
switchTab("about:home#1", false);

Просмотреть файл

@ -1,114 +0,0 @@
const CHROME_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
const CONTENT_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
const CHROME = {
id: "cb34538a-d9da-40f3-b61a-069f0b2cb9fb",
path: "test-chrome",
flags: 0,
}
const CANREMOTE = {
id: "2480d3e1-9ce4-4b84-8ae3-910b9a95cbb3",
path: "test-allowremote",
flags: Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD,
}
const MUSTREMOTE = {
id: "f849cee5-e13e-44d2-981d-0fb3884aaead",
path: "test-mustremote",
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD,
}
const TEST_MODULES = [
CHROME,
CANREMOTE,
MUSTREMOTE
]
function AboutModule() {
}
AboutModule.prototype = {
newChannel: function(aURI, aLoadInfo) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
getURIFlags: function(aURI) {
for (let module of TEST_MODULES) {
if (aURI.path.startsWith(module.path)) {
return module.flags;
}
}
ok(false, "Called getURIFlags for an unknown page " + aURI.spec);
return 0;
},
getIndexedDBOriginPostfix: function(aURI) {
return null;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule])
};
let AboutModuleFactory = {
createInstance: function(aOuter, aIID) {
if (aOuter)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return new AboutModule().QueryInterface(aIID);
},
lockFactory: function(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};
add_task(function* init() {
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
for (let module of TEST_MODULES) {
registrar.registerFactory(Components.ID(module.id), "",
"@mozilla.org/network/protocol/about;1?what=" + module.path,
AboutModuleFactory);
}
});
registerCleanupFunction(() => {
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
for (let module of TEST_MODULES) {
registrar.unregisterFactory(Components.ID(module.id), AboutModuleFactory);
}
});
function test_url(url, chromeResult, contentResult) {
is(E10SUtils.canLoadURIInProcess(url, CHROME_PROCESS),
chromeResult, "Check URL in chrome process.");
is(E10SUtils.canLoadURIInProcess(url, CONTENT_PROCESS),
contentResult, "Check URL in content process.");
is(E10SUtils.canLoadURIInProcess(url + "#foo", CHROME_PROCESS),
chromeResult, "Check URL with ref in chrome process.");
is(E10SUtils.canLoadURIInProcess(url + "#foo", CONTENT_PROCESS),
contentResult, "Check URL with ref in content process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo", CHROME_PROCESS),
chromeResult, "Check URL with query in chrome process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo", CONTENT_PROCESS),
contentResult, "Check URL with query in content process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CHROME_PROCESS),
chromeResult, "Check URL with query and ref in chrome process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CONTENT_PROCESS),
contentResult, "Check URL with query and ref in content process.");
}
add_task(function* test_chrome() {
test_url("about:" + CHROME.path, true, false);
});
add_task(function* test_any() {
test_url("about:" + CANREMOTE.path, true, true);
});
add_task(function* test_remote() {
test_url("about:" + MUSTREMOTE.path, false, true);
});

Просмотреть файл

@ -1,150 +0,0 @@
// Returns a function suitable for add_task which loads startURL, runs
// transitionTask and waits for endURL to load, checking that the URLs were
// loaded in the correct process.
function makeTest(name, startURL, startProcessIsRemote, endURL, endProcessIsRemote, transitionTask) {
return function*() {
info("Running test " + name + ", " + transitionTask.name);
let browser = gBrowser.selectedBrowser;
// In non-e10s nothing should be remote
if (!gMultiProcessBrowser) {
startProcessIsRemote = false;
endProcessIsRemote = false;
}
// Load the initial URL and make sure we are in the right initial process
info("Loading initial URL");
browser.loadURI(startURL);
yield waitForDocLoadComplete();
is(browser.currentURI.spec, startURL, "Shouldn't have been redirected");
is(browser.isRemoteBrowser, startProcessIsRemote, "Should be displayed in the right process");
let docLoadedPromise = waitForDocLoadComplete();
let asyncTask = Task.async(transitionTask);
let expectSyncChange = yield asyncTask(browser, endURL);
if (expectSyncChange) {
is(browser.isRemoteBrowser, endProcessIsRemote, "Should have switched to the right process synchronously");
}
yield docLoadedPromise;
is(browser.currentURI.spec, endURL, "Should have made it to the final URL");
is(browser.isRemoteBrowser, endProcessIsRemote, "Should be displayed in the right process");
}
}
const CHROME_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
const CONTENT_PROCESS = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
const PATH = (getRootDirectory(gTestPath) + "test_process_flags_chrome.html").replace("chrome://mochitests", "");
const CHROME = "chrome://mochitests" + PATH;
const CANREMOTE = "chrome://mochitests-any" + PATH;
const MUSTREMOTE = "chrome://mochitests-content" + PATH;
add_task(function* init() {
gBrowser.selectedTab = gBrowser.addTab("about:blank");
});
registerCleanupFunction(() => {
gBrowser.removeCurrentTab();
});
function test_url(url, chromeResult, contentResult) {
is(E10SUtils.canLoadURIInProcess(url, CHROME_PROCESS),
chromeResult, "Check URL in chrome process.");
is(E10SUtils.canLoadURIInProcess(url, CONTENT_PROCESS),
contentResult, "Check URL in content process.");
is(E10SUtils.canLoadURIInProcess(url + "#foo", CHROME_PROCESS),
chromeResult, "Check URL with ref in chrome process.");
is(E10SUtils.canLoadURIInProcess(url + "#foo", CONTENT_PROCESS),
contentResult, "Check URL with ref in content process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo", CHROME_PROCESS),
chromeResult, "Check URL with query in chrome process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo", CONTENT_PROCESS),
contentResult, "Check URL with query in content process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CHROME_PROCESS),
chromeResult, "Check URL with query and ref in chrome process.");
is(E10SUtils.canLoadURIInProcess(url + "?foo#bar", CONTENT_PROCESS),
contentResult, "Check URL with query and ref in content process.");
}
add_task(function* test_chrome() {
test_url(CHROME, true, false);
});
add_task(function* test_any() {
test_url(CANREMOTE, true, true);
});
add_task(function* test_remote() {
test_url(MUSTREMOTE, false, true);
});
// The set of page transitions
let TESTS = [
[
"chrome -> chrome",
CHROME, false,
CHROME, false,
],
[
"chrome -> canremote",
CHROME, false,
CANREMOTE, false,
],
[
"chrome -> mustremote",
CHROME, false,
MUSTREMOTE, true,
],
[
"remote -> chrome",
MUSTREMOTE, true,
CHROME, false,
],
[
"remote -> canremote",
MUSTREMOTE, true,
CANREMOTE, true,
],
[
"remote -> mustremote",
MUSTREMOTE, true,
MUSTREMOTE, true,
],
];
// The different ways to transition from one page to another
let TRANSITIONS = [
// Loads the new page by calling browser.loadURI directly
function* loadURI(browser, uri) {
info("Calling browser.loadURI");
browser.loadURI(uri);
return true;
},
// Loads the new page by finding a link with the right href in the document and
// clicking it
function* clickLink(browser, uri) {
info("Clicking link");
function frame_script(uri) {
let link = content.document.querySelector("a[href='" + uri + "']");
link.click();
}
browser.messageManager.loadFrameScript("data:,(" + frame_script.toString() + ")(" + JSON.stringify(uri) + ");", false);
return false;
},
];
// Creates a set of test tasks, one for each combination of TESTS and TRANSITIONS.
for (let test of TESTS) {
for (let transition of TRANSITIONS) {
add_task(makeTest(...test, transition));
}
}

Просмотреть файл

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<p>chrome: test page</p>
<p><a href="chrome://mochitests/content/browser/browser/base/content/test/general/test_process_flags_chrome.html">chrome</a></p>
<p><a href="chrome://mochitests-any/content/browser/browser/base/content/test/general/test_process_flags_chrome.html">canremote</a></p>
<p><a href="chrome://mochitests-content/content/browser/browser/base/content/test/general/test_process_flags_chrome.html">mustremote</a></p>
</body>
</html>

Просмотреть файл

@ -42,7 +42,6 @@ static RedirEntry kRedirMap[] = {
#endif
{ "certerror", "chrome://browser/content/certerror/aboutCertError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
{ "socialerror", "chrome://browser/content/aboutSocialError.xhtml",
@ -84,7 +83,6 @@ static RedirEntry kRedirMap[] = {
#endif
{ "home", "chrome://browser/content/abouthome/aboutHome.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::ENABLE_INDEXED_DB },
{ "newtab", "chrome://browser/content/newtab/newTab.xul",

Просмотреть файл

@ -3,8 +3,8 @@
"use strict";
const URL = HTTPROOT + "browser_frametree_sample.html";
const URL_FRAMESET = HTTPROOT + "browser_frametree_sample_frameset.html";
const URL = ROOT + "browser_frametree_sample.html";
const URL_FRAMESET = ROOT + "browser_frametree_sample_frameset.html";
/**
* This ensures that loading a page normally, aborting a page load, reloading

Просмотреть файл

@ -6,7 +6,6 @@ const TAB_STATE_NEEDS_RESTORE = 1;
const TAB_STATE_RESTORING = 2;
const ROOT = getRootDirectory(gTestPath);
const HTTPROOT = ROOT.replace("chrome://mochitests/content/", "http://example.com/");
const FRAME_SCRIPTS = [
ROOT + "content.js",
ROOT + "content-forms.js"

Просмотреть файл

@ -10,67 +10,38 @@ const {interfaces: Ci, utils: Cu, classes: Cc} = Components;
Cu.import("resource://gre/modules/Services.jsm");
function getAboutModule(aURL) {
// Needs to match NS_GetAboutModuleName
let moduleName = aURL.path.replace(/[#?].*/, "").toLowerCase();
let contract = "@mozilla.org/network/protocol/about;1?what=" + moduleName;
try {
return Cc[contract].getService(Ci.nsIAboutModule);
}
catch (e) {
// Either the about module isn't defined or it is broken. In either case
// ignore it.
return null;
}
}
this.E10SUtils = {
canLoadURIInProcess: function(aURL, aProcess) {
shouldBrowserBeRemote: function(aURL) {
// loadURI in browser.xml treats null as about:blank
if (!aURL)
aURL = "about:blank";
let processIsRemote = aProcess == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
let canLoadRemote = true;
let mustLoadRemote = true;
if (aURL.startsWith("about:")) {
let url = Services.io.newURI(aURL, null, null);
let module = getAboutModule(url);
// If the module doesn't exist then an error page will be loading, that
// should be ok to load in either process
if (module) {
let flags = module.getURIFlags(url);
canLoadRemote = !!(flags & Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD);
mustLoadRemote = !!(flags & Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD);
}
}
if (aURL.startsWith("chrome:")) {
let url = Services.io.newURI(aURL, null, null);
let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry);
canLoadRemote = chromeReg.canLoadURLRemotely(url);
mustLoadRemote = chromeReg.mustLoadURLRemotely(url);
}
if (mustLoadRemote)
return processIsRemote;
if (!canLoadRemote && processIsRemote)
if (aURL.startsWith("about:") &&
aURL.toLowerCase() != "about:home" &&
aURL.toLowerCase() != "about:blank" &&
!aURL.toLowerCase().startsWith("about:neterror") &&
!aURL.toLowerCase().startsWith("about:certerror")) {
return false;
}
return true;
},
shouldLoadURI: function(aDocShell, aURI, aReferrer) {
// about:blank is the initial document and can load anywhere
if (aURI.spec == "about:blank")
return true;
// Inner frames should always load in the current process
if (aDocShell.QueryInterface(Ci.nsIDocShellTreeItem).sameTypeParent)
return true;
// If the URI can be loaded in the current process then continue
return this.canLoadURIInProcess(aURI.spec, Services.appinfo.processType);
let isRemote = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
if (this.shouldBrowserBeRemote(aURI.spec) == isRemote)
return true;
return false;
},
redirectLoad: function(aDocShell, aURI, aReferrer) {

Просмотреть файл

@ -592,70 +592,6 @@ nsChromeRegistry::AllowContentToAccess(nsIURI *aURI, bool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::CanLoadURLRemotely(nsIURI *aURI, bool *aResult)
{
nsresult rv;
*aResult = false;
#ifdef DEBUG
bool isChrome;
aURI->SchemeIs("chrome", &isChrome);
NS_ASSERTION(isChrome, "Non-chrome URI passed to CanLoadURLRemotely!");
#endif
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
if (!url) {
NS_ERROR("Chrome URL doesn't implement nsIURL.");
return NS_ERROR_UNEXPECTED;
}
nsAutoCString package;
rv = url->GetHostPort(package);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t flags;
rv = GetFlagsFromPackage(package, &flags);
if (NS_SUCCEEDED(rv)) {
*aResult = !!(flags & REMOTE_ALLOWED);
}
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::MustLoadURLRemotely(nsIURI *aURI, bool *aResult)
{
nsresult rv;
*aResult = false;
#ifdef DEBUG
bool isChrome;
aURI->SchemeIs("chrome", &isChrome);
NS_ASSERTION(isChrome, "Non-chrome URI passed to MustLoadURLRemotely!");
#endif
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
if (!url) {
NS_ERROR("Chrome URL doesn't implement nsIURL.");
return NS_ERROR_UNEXPECTED;
}
nsAutoCString package;
rv = url->GetHostPort(package);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t flags;
rv = GetFlagsFromPackage(package, &flags);
if (NS_SUCCEEDED(rv)) {
*aResult = !!(flags & REMOTE_REQUIRED);
}
return NS_OK;
}
NS_IMETHODIMP_(bool)
nsChromeRegistry::WrappersEnabled(nsIURI *aURI)
{

Просмотреть файл

@ -53,10 +53,6 @@ public:
bool* _retval) MOZ_OVERRIDE;
NS_IMETHOD AllowContentToAccess(nsIURI* url,
bool* _retval) MOZ_OVERRIDE;
NS_IMETHOD CanLoadURLRemotely(nsIURI* url,
bool* _retval) MOZ_OVERRIDE;
NS_IMETHOD MustLoadURLRemotely(nsIURI* url,
bool* _retval) MOZ_OVERRIDE;
// nsIChromeRegistry methods:
NS_IMETHOD_(bool) WrappersEnabled(nsIURI *aURI) MOZ_OVERRIDE;
@ -124,19 +120,26 @@ public:
};
virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) = 0;
char *const * argv, bool platform,
bool contentaccessible) = 0;
// Available flags
enum {
@ -150,13 +153,7 @@ public:
XPCNATIVEWRAPPERS = 1 << 1,
// Content script may access files in this package
CONTENT_ACCESSIBLE = 1 << 2,
// Package may be loaded remotely
REMOTE_ALLOWED = 1 << 3,
// Package must be loaded remotely
REMOTE_REQUIRED = 1 << 4,
CONTENT_ACCESSIBLE = 1 << 2
};
bool mInitialized;

Просмотреть файл

@ -772,7 +772,8 @@ SendManifestEntry(const ChromeRegistryItem &aItem)
void
nsChromeRegistryChrome::ManifestContent(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* package = argv[0];
char* uri = argv[1];
@ -796,7 +797,11 @@ nsChromeRegistryChrome::ManifestContent(ManifestProcessingContext& cx, int linen
nsDependentCString packageName(package);
PackageEntry* entry = mPackagesHash.LookupOrAdd(packageName);
entry->baseURI = resolved;
entry->flags = flags;
if (platform)
entry->flags |= PLATFORM_PACKAGE;
if (contentaccessible)
entry->flags |= CONTENT_ACCESSIBLE;
if (mDynamicRegistration) {
ChromePackage chromePackage;
@ -808,7 +813,8 @@ nsChromeRegistryChrome::ManifestContent(ManifestProcessingContext& cx, int linen
void
nsChromeRegistryChrome::ManifestLocale(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* package = argv[0];
char* provider = argv[1];
@ -844,7 +850,8 @@ nsChromeRegistryChrome::ManifestLocale(ManifestProcessingContext& cx, int lineno
void
nsChromeRegistryChrome::ManifestSkin(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* package = argv[0];
char* provider = argv[1];
@ -880,7 +887,8 @@ nsChromeRegistryChrome::ManifestSkin(ManifestProcessingContext& cx, int lineno,
void
nsChromeRegistryChrome::ManifestOverlay(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* base = argv[0];
char* overlay = argv[1];
@ -907,7 +915,8 @@ nsChromeRegistryChrome::ManifestOverlay(ManifestProcessingContext& cx, int linen
void
nsChromeRegistryChrome::ManifestStyle(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* base = argv[0];
char* overlay = argv[1];
@ -934,7 +943,8 @@ nsChromeRegistryChrome::ManifestStyle(ManifestProcessingContext& cx, int lineno,
void
nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* chrome = argv[0];
char* resolved = argv[1];
@ -968,7 +978,8 @@ nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx, int line
void
nsChromeRegistryChrome::ManifestResource(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
char* package = argv[0];
char* uri = argv[1];

Просмотреть файл

@ -166,19 +166,26 @@ class nsChromeRegistryChrome : public nsChromeRegistry
nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
};
#endif // nsChromeRegistryChrome_h

Просмотреть файл

@ -257,7 +257,7 @@ nsresult nsChromeRegistryContent::UpdateSelectedLocale()
void
nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx,
int lineno, char *const * argv,
int flags)
bool platform, bool contentaccessible)
{
CONTENT_NOTREACHED();
}
@ -265,7 +265,8 @@ nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx,
void
nsChromeRegistryContent::ManifestLocale(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
CONTENT_NOTREACHED();
}
@ -273,14 +274,16 @@ nsChromeRegistryContent::ManifestLocale(ManifestProcessingContext& cx,
void
nsChromeRegistryContent::ManifestSkin(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestOverlay(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
CONTENT_NOTREACHED();
}
@ -288,7 +291,8 @@ nsChromeRegistryContent::ManifestOverlay(ManifestProcessingContext& cx, int line
void
nsChromeRegistryContent::ManifestStyle(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
CONTENT_NOTREACHED();
}
@ -296,7 +300,8 @@ nsChromeRegistryContent::ManifestStyle(ManifestProcessingContext& cx,
void
nsChromeRegistryContent::ManifestOverride(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
CONTENT_NOTREACHED();
}
@ -304,7 +309,8 @@ nsChromeRegistryContent::ManifestOverride(ManifestProcessingContext& cx,
void
nsChromeRegistryContent::ManifestResource(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
char *const * argv, bool platform,
bool contentaccessible)
{
CONTENT_NOTREACHED();
}

Просмотреть файл

@ -65,19 +65,26 @@ class nsChromeRegistryContent : public nsChromeRegistry
nsCString mLocale;
virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags) MOZ_OVERRIDE;
char *const * argv, bool platform,
bool contentaccessible) MOZ_OVERRIDE;
};
#endif // nsChromeRegistryContent_h

Просмотреть файл

@ -45,7 +45,7 @@ interface nsIChromeRegistry : nsISupports
[notxpcom] boolean wrappersEnabled(in nsIURI aURI);
};
[scriptable, uuid(93251ddf-5e85-4172-ac2a-31780562974f)]
[scriptable, uuid(c2461347-2b8f-48c7-9d59-3a61fb868828)]
interface nsIXULChromeRegistry : nsIChromeRegistry
{
/* Should be called when locales change to reload all chrome (including XUL). */
@ -73,20 +73,6 @@ interface nsIXULChromeRegistry : nsIChromeRegistry
* Do not pass non-chrome URIs to this method.
*/
boolean allowContentToAccess(in nsIURI url);
/**
* Returns true if the passed chrome URL is allowed to be loaded in a remote
* process. This reflects the remoteenabled flag on packages.
* Do not pass non-chrome URIs to this method.
*/
boolean canLoadURLRemotely(in nsIURI url);
/**
* Returns true if the passed chrome URL must be loaded in a remote process.
* This reflects the remoterequired flag on packages.
* Do not pass non-chrome URIs to this method.
*/
boolean mustLoadURLRemotely(in nsIURI url);
};
%{ C++

Просмотреть файл

@ -49,7 +49,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
{ "neterror", "chrome://global/content/netError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
{ "memory", "chrome://global/content/aboutMemory.xhtml",

Просмотреть файл

@ -55,7 +55,6 @@ NS_IMETHODIMP
nsAboutBlank::GetURIFlags(nsIURI *aURI, uint32_t *result)
{
*result = nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::HIDE_FROM_ABOUTABOUT;
return NS_OK;
}

Просмотреть файл

@ -50,16 +50,6 @@ interface nsIAboutModule : nsISupports
*/
const unsigned long ENABLE_INDEXED_DB = (1 << 3);
/**
* A flag that indicates that this URI can be loaded in a child process
*/
const unsigned long URI_CAN_LOAD_IN_CHILD = (1 << 4);
/**
* A flag that indicates that this URI must be loaded in a child process
*/
const unsigned long URI_MUST_LOAD_IN_CHILD = (1 << 5);
/**
* 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

Просмотреть файл

@ -797,8 +797,6 @@ class MochitestUtilsMixin(object):
# Register chrome directory.
chrometestDir = self.getChromeTestDir(options)
manifestFile.write("content mochitests %s contentaccessible=yes\n" % chrometestDir)
manifestFile.write("content mochitests-any %s contentaccessible=yes remoteenabled=yes\n" % chrometestDir)
manifestFile.write("content mochitests-content %s contentaccessible=yes remoterequired=yes\n" % chrometestDir)
if options.testingModulesDir is not None:
manifestFile.write("resource testing-common file:///%s\n" %

Просмотреть файл

@ -74,7 +74,8 @@ struct ManifestDirective
int aLineNo, char* const* aArgv);
void (nsChromeRegistry::*regfunc)(
nsChromeRegistry::ManifestProcessingContext& aCx,
int aLineNo, char* const* aArgv, int aFlags);
int aLineNo, char* const* aArgv,
bool aPlatform, bool aContentAccessible);
#ifdef MOZ_B2G_LOADER
// The function to handle the directive for XPT Only parsing.
void (*xptonlyfunc)(
@ -486,8 +487,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
NS_NAMED_LITERAL_STRING(kPlatform, "platform");
NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible");
NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
NS_NAMED_LITERAL_STRING(kApplication, "application");
NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
@ -685,7 +684,8 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
#if defined(MOZ_WIDGET_ANDROID)
TriState stTablet = eUnspecified;
#endif
int flags = 0;
bool platform = false;
bool contentAccessible = false;
while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
ok) {
@ -710,28 +710,10 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
}
#endif
if (directive->contentflags) {
bool flag;
if (CheckFlag(kPlatform, wtoken, flag)) {
if (flag)
flags |= nsChromeRegistry::PLATFORM_PACKAGE;
continue;
}
if (CheckFlag(kContentAccessible, wtoken, flag)) {
if (flag)
flags |= nsChromeRegistry::CONTENT_ACCESSIBLE;
continue;
}
if (CheckFlag(kRemoteEnabled, wtoken, flag)) {
if (flag)
flags |= nsChromeRegistry::REMOTE_ALLOWED;
continue;
}
if (CheckFlag(kRemoteRequired, wtoken, flag)) {
if (flag)
flags |= nsChromeRegistry::REMOTE_REQUIRED;
continue;
}
if (directive->contentflags &&
(CheckFlag(kPlatform, wtoken, platform) ||
CheckFlag(kContentAccessible, wtoken, contentAccessible))) {
continue;
}
bool xpcNativeWrappers = true; // Dummy for CheckFlag.
@ -783,7 +765,7 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
}
(nsChromeRegistry::gChromeRegistry->*(directive->regfunc))(
chromecx, line, argv, flags);
chromecx, line, argv, platform, contentAccessible);
} else if (directive->ischrome || !aChromeOnly) {
if (directive->isContract) {
CachedDirective* cd = contracts.AppendElement();