Merge m-i to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2015-07-04 11:07:23 -07:00
commit 7f435e44fe
403 changed files with 2842 additions and 1859 deletions

View File

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1178215 requires clobber for libvpx file moves.
Bug 1178892 requires clobber for profiler file moves.

View File

@ -1265,7 +1265,7 @@ nsAccessibilityService::Init()
logging::CheckEnv();
#endif
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
gApplicationAccessible = new ApplicationAccessibleWrap();
else
gApplicationAccessible = new ApplicationAccessible();
@ -1286,7 +1286,7 @@ nsAccessibilityService::Init()
gIsShutdown = false;
// Now its safe to start platform accessibility.
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
PlatformInit();
return true;
@ -1329,7 +1329,7 @@ nsAccessibilityService::Shutdown()
gIsShutdown = true;
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
PlatformShutdown();
gApplicationAccessible->Shutdown();

View File

@ -282,7 +282,7 @@ IPCAccessibilityActive()
#ifdef MOZ_B2G
return false;
#else
return XRE_GetProcessType() == GeckoProcessType_Content &&
return XRE_IsContentProcess() &&
mozilla::Preferences::GetBool("accessibility.ipc_architecture.enabled", true);
#endif
}

View File

@ -425,7 +425,7 @@ nsCoreUtils::IsTabDocument(nsIDocument* aDocumentNode)
treeItem->GetParent(getter_AddRefs(parentTreeItem));
// Tab document running in own process doesn't have parent.
if (XRE_GetProcessType() == GeckoProcessType_Content)
if (XRE_IsContentProcess())
return !parentTreeItem;
// Parent of docshell for tab document running in chrome process is root.

View File

@ -64,7 +64,7 @@ nsWinUtils::MaybeStartWindowEmulation()
if (Compatibility::IsJAWS() || Compatibility::IsWE() ||
Compatibility::IsDolphin() ||
XRE_GetProcessType() == GeckoProcessType_Content) {
XRE_IsContentProcess()) {
RegisterNativeWindow(kClassNameTabContent);
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(2);
return true;

View File

@ -355,11 +355,10 @@ var FullScreen = {
"fullscreen",
Services.perms.ALLOW_ACTION,
Services.perms.EXPIRE_SESSION);
let host = uri.host;
var onFullscreenchange = function onFullscreenchange(event) {
if (event.target == document && document.mozFullScreenElement == null) {
// The chrome document has left fullscreen. Remove the temporary permission grant.
Services.perms.remove(host, "fullscreen");
Services.perms.remove(uri, "fullscreen");
document.removeEventListener("mozfullscreenchange", onFullscreenchange);
}
}

View File

@ -85,7 +85,7 @@ let TrackingProtection = {
// Remove the current host from the 'trackingprotection' consumer
// of the permission manager. This effectively removes this host
// from the tracking protection allowlist.
Services.perms.remove(gBrowser.selectedBrowser.currentURI.host,
Services.perms.remove(gBrowser.selectedBrowser.currentURI,
"trackingprotection");
// Telemetry for enable protection.

View File

@ -862,7 +862,7 @@ function onBlockImage()
if (checkbox.checked)
permissionManager.add(uri, "image", nsIPermissionManager.DENY_ACTION);
else
permissionManager.remove(uri.host, "image");
permissionManager.remove(uri, "image");
}
function onImageSelect()

View File

@ -283,7 +283,7 @@ function test_whitelisted_install() {
is(aInstalls.length, 1, "Should be one pending install");
aInstalls[0].cancel();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -315,7 +315,7 @@ function test_failed_download() {
"The add-on could not be downloaded because of a connection failure.",
"Should have seen the right message");
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -342,7 +342,7 @@ function test_corrupt_file() {
"because it appears to be corrupt.",
"Should have seen the right message");
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -369,7 +369,7 @@ function test_incompatible() {
gApp + " " + gVersion + ".",
"Should have seen the right message");
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -403,7 +403,7 @@ function test_restartless() {
AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(aAddon) {
aAddon.uninstall();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -444,7 +444,7 @@ function test_multiple() {
AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(aAddon) {
aAddon.uninstall();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -516,7 +516,7 @@ function test_sequential() {
is(container.childNodes.length, 1, "Should be one item listed");
is(container.childNodes[0].firstChild.getAttribute("value"), "Theme Test", "Should have the right add-on");
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com"), "install");
wait_for_notification_close(() => {
gBrowser.removeTab(gBrowser.selectedTab);
runNextTest();
@ -580,7 +580,7 @@ function test_someunverified() {
t.userDisabled = true;
t.uninstall();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -628,7 +628,7 @@ function test_allunverified() {
AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(aAddon) {
aAddon.uninstall();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -795,7 +795,7 @@ function test_reload() {
is(aInstalls.length, 1, "Should be one pending install");
aInstalls[0].cancel();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -839,7 +839,7 @@ function test_theme() {
isnot(aAddon, null, "Test theme will have been installed");
aAddon.uninstall();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -918,7 +918,7 @@ function test_renotify_installed() {
is(aInstalls.length, 1, "Should be one pending installs");
aInstalls[0].cancel();
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
});
@ -986,7 +986,7 @@ function test_cancel() {
AddonManager.getAllInstalls(function(aInstalls) {
is(aInstalls.length, 0, "Should be no pending install");
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
gBrowser.removeTab(gBrowser.selectedTab);
runNextTest();
});

View File

@ -37,7 +37,7 @@ function test_install_http() {
gBrowser.removeTab(gBrowser.selectedTab);
pm.remove("example.org", "install");
pm.remove(makeURI("http://example.org/"), "install");
runNextTest();
});
@ -66,7 +66,7 @@ function test_install_lwtheme() {
LightweightThemeManager.currentTheme = null;
gBrowser.removeTab(gBrowser.selectedTab);
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com/"), "install");
runNextTest();
});
@ -106,7 +106,7 @@ function test_lwtheme_switch_theme() {
gBrowser.removeTab(gBrowser.selectedTab);
Services.perms.remove("example.com", "install");
Services.perms.remove(makeURI("http://example.com"), "install");
runNextTest();
});

View File

@ -567,7 +567,7 @@ let gTests = [
is(devicePerms, aExpected ? Perms.ALLOW_ACTION : Perms.DENY_ACTION,
aDevice + " persistently " + (aExpected ? "allowed" : "denied"));
}
Perms.remove(uri.host, aDevice);
Perms.remove(uri, aDevice);
}
checkDevicePermissions("microphone", aExpectedAudioPerm);
checkDevicePermissions("camera", aExpectedVideoPerm);
@ -673,8 +673,8 @@ let gTests = [
}
}
Perms.remove(uri.host, "camera");
Perms.remove(uri.host, "microphone");
Perms.remove(uri, "camera");
Perms.remove(uri, "microphone");
}
// Set both permissions identically
@ -794,8 +794,8 @@ let gTests = [
// Cleanup.
yield closeStream(true);
Perms.remove(uri.host, "camera");
Perms.remove(uri.host, "microphone");
Perms.remove(uri, "camera");
Perms.remove(uri, "microphone");
}
info("request audio+video, stop sharing resets both");
@ -888,8 +888,8 @@ let gTests = [
// Cleanup.
yield closeStream(true);
Perms.remove(uri.host, "camera");
Perms.remove(uri.host, "microphone");
Perms.remove(uri, "camera");
Perms.remove(uri, "microphone");
}
}

View File

@ -14,7 +14,7 @@ function test () {
let pm = Services.perms;
registerCleanupFunction(function() {
pm.remove(notificationURL, "desktop-notification");
pm.remove(makeURI(notificationURL), "desktop-notification");
gBrowser.removeTab(tab);
window.restore();
});

View File

@ -44,7 +44,7 @@ add_task(function*() {
"remote-troubleshooting",
Services.perms.ALLOW_ACTION);
registerCleanupFunction(() => {
Services.perms.remove(TEST_URI_GOOD.spec, "remote-troubleshooting");
Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting");
});
// Try again - now we are expecting a response with the actual data.

View File

@ -177,7 +177,7 @@ function clearAllPermissionsByPrefix(aPrefix) {
while (perms.hasMoreElements()) {
let perm = perms.getNext();
if (perm.type.startsWith(aPrefix)) {
Services.perms.remove(perm.host, perm.type);
Services.perms.removePermission(perm);
}
}
}

View File

@ -38,8 +38,8 @@ function pageInfoObserve(win, topic, data) {
}
function finishTest() {
gPermissionManager.remove("127.0.0.1:8888", gTestPermissionString);
gPermissionManager.remove("127.0.0.1:8888", gSecondTestPermissionString);
gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
Services.prefs.clearUserPref("plugins.click_to_play");
gBrowser.removeCurrentTab();
@ -59,8 +59,8 @@ function test() {
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
gBrowser.selectedTab = gBrowser.addTab();
gTestBrowser = gBrowser.selectedBrowser;
gPermissionManager.remove("127.0.0.1:8888", gTestPermissionString);
gPermissionManager.remove("127.0.0.1:8888", gSecondTestPermissionString);
gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart1a);
}
@ -141,8 +141,8 @@ function testPart3() {
"part 3: Second test plugin should be marked as PLUGIN_DISABLED");
// reset permissions
gPermissionManager.remove("127.0.0.1:8888", gTestPermissionString);
gPermissionManager.remove("127.0.0.1:8888", gSecondTestPermissionString);
gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
// check that changing the permissions affects the radio state in the
// open Page Info window
let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");

View File

@ -239,7 +239,7 @@ function clearAllPluginPermissions() {
let perm = perms.getNext();
if (perm.type.startsWith('plugin')) {
info("removing permission:" + perm.host + " " + perm.type + "\n");
Services.perms.remove(perm.host, perm.type);
Services.perms.removePermission(perm);
}
}
}

View File

@ -2435,7 +2435,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Remove the current host from the 'trackingprotection' consumer
// of the permission manager. This effectively removes this host
// from the tracking protection allowlist.
Services.perms.remove(gBrowser.selectedBrowser.currentURI.host,
Services.perms.remove(gBrowser.selectedBrowser.currentURI,
"trackingprotection");
BrowserReload();
]]></body>

View File

@ -179,7 +179,7 @@ Site.prototype = {
* e.g. "cookie", "geo", "indexedDB", "popup", "image"
*/
clearPermission: function Site_clearPermission(aType) {
Services.perms.remove(this.host, aType);
Services.perms.remove(this.httpURI, aType);
},
/**

View File

@ -458,7 +458,7 @@ var gAdvancedPane = {
},
// XXX: duplicated in browser.js
_getOfflineAppUsage: function (host, groups)
_getOfflineAppUsage: function (perm, groups)
{
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
@ -471,7 +471,7 @@ var gAdvancedPane = {
var usage = 0;
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) {
if (uri.asciiHost == perm.host) {
var cache = cacheService.getActiveCache(groups[i]);
usage += cache.usage;
}
@ -510,7 +510,7 @@ var gAdvancedPane = {
row.className = "offlineapp";
row.setAttribute("host", perm.host);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm.host, groups));
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
@ -557,7 +557,7 @@ var gAdvancedPane = {
getService(Components.interfaces.nsIIOService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
let uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
@ -567,10 +567,15 @@ var gAdvancedPane = {
// remove the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
pm.remove(host, "offline-app",
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
pm.remove(host, "offline-app",
Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
let uri;
try {
// file:// URIs are stored with their scheme. We try to parse them first, as
// URIs like http://file:///foo/bar/baz.html will parse as HTTP URIs.
uri = ios.newURI(host, null, null);
} catch (e) {
uri = ios.newURI("http://" + host, null, null);
}
pm.remove(uri, "offline-app");
list.removeChild(item);
gAdvancedPane.offlineAppSelected();

View File

@ -492,7 +492,7 @@ var gAdvancedPane = {
},
// XXX: duplicated in browser.js
_getOfflineAppUsage: function (host, groups)
_getOfflineAppUsage: function (perm, groups)
{
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
@ -502,7 +502,7 @@ var gAdvancedPane = {
var usage = 0;
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) {
if (uri.asciiHost == perm.host) {
var cache = cacheService.getActiveCache(groups[i]);
usage += cache.usage;
}
@ -546,7 +546,7 @@ var gAdvancedPane = {
row.className = "offlineapp";
row.setAttribute("host", perm.host);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm.host, groups));
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
@ -594,7 +594,7 @@ var gAdvancedPane = {
getService(Components.interfaces.nsIIOService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
let uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
@ -605,10 +605,15 @@ var gAdvancedPane = {
// remove the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
pm.remove(host, "offline-app",
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
pm.remove(host, "offline-app",
Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
let uri;
try {
// file:// URIs are stored with their scheme. We try to parse them first, as
// URIs like http://file:///foo/bar/baz.html will parse as HTTP URIs.
uri = ios.newURI(host, null, null);
} catch (e) {
uri = ios.newURI("http://" + host, null, null);
}
pm.remove(uri, "offline-app");
list.removeChild(item);
gAdvancedPane.offlineAppSelected();

View File

@ -368,7 +368,8 @@ var gPermissionManager = {
}
for (let p of this._permissionsToDelete.values()) {
Services.perms.remove(p.host, p.type);
let uri = Services.io.newURI("http://" + p.host, null, null);
Services.perms.remove(uri, p.type);
}
window.close();

View File

@ -54,9 +54,9 @@ function setup(aCallback) {
function cleanUp() {
for (let type in TEST_PERMS) {
if (type != "password") {
Services.perms.remove(TEST_URI_1.host, type);
Services.perms.remove(TEST_URI_2.host, type);
Services.perms.remove(TEST_URI_3.host, type);
Services.perms.remove(TEST_URI_1, type);
Services.perms.remove(TEST_URI_2, type);
Services.perms.remove(TEST_URI_3, type);
}
}
}

View File

@ -64,7 +64,8 @@ var testRunner = {
observances: [{ type: "popup", host: "test.com", data: "added",
capability: Ci.nsIPermissionManager.DENY_ACTION }],
cleanUp: function(params) {
params.pm.remove("test.com", "popup");
let uri = params.ioService.newURI("http://test.com", null, null);
params.pm.remove(uri, "popup");
},
},
],

View File

@ -188,8 +188,10 @@ let gTranslationExceptions = {
onSiteDeleted: function() {
let removedSites = this._siteTree.getSelectedItems();
for (let host of removedSites)
Services.perms.remove(host, kPermissionType);
for (let host of removedSites) {
let uri = Services.io.newURI("http://" + host, null, null);
Services.perms.remove(uri, kPermissionType);
}
},
onAllSitesDeleted: function() {
@ -199,8 +201,10 @@ let gTranslationExceptions = {
let removedSites = this._sites.splice(0, this._sites.length);
this._siteTree.boxObject.rowCountChanged(0, -removedSites.length);
for (let host of removedSites)
Services.perms.remove(host, kPermissionType);
for (let host of removedSites) {
let uri = Services.io.newURI("http://" + host, null, null);
Services.perms.remove(uri, kPermissionType);
}
this.onSiteSelected();
},

View File

@ -194,7 +194,7 @@ let gTests = [
"The 'Never translate French' item is disabled");
// Cleanup.
Services.perms.remove("example.com", "translate");
Services.perms.remove(makeURI("http://example.com"), "translate");
notif.close();
}
},
@ -287,8 +287,8 @@ let gTests = [
is(getDomainExceptions().length, 1, "One exception in the permissions");
// Clear the permissions, and check the last item is removed from the display.
perms.remove("example.org", "translate");
perms.remove("example.com", "translate");
perms.remove(makeURI("http://example.org"), "translate");
perms.remove(makeURI("http://example.com"), "translate");
is(tree.view.rowCount, 0, "The site exceptions list is empty");
ok(remove.disabled, "The 'Remove Site' button is disabled");
ok(removeAll.disabled, "The 'Remove All Site' button is disabled");

View File

@ -212,7 +212,7 @@ function UITourTest() {
gBrowser.removeTab(gTestTab);
delete window.gTestTab;
Services.prefs.clearUserPref("browser.uitour.enabled", true);
Services.perms.remove("example.com", "uitour");
Services.perms.remove(testUri, "uitour");
});
function done() {

View File

@ -93,7 +93,7 @@ this.SitePermissions = {
if (!this.isSupportedURI(aURI))
return;
Services.perms.remove(aURI.host, aPermissionID);
Services.perms.remove(aURI, aPermissionID);
},
/* Returns the localized label for the permission with the given ID, to be

View File

@ -112,7 +112,7 @@ add_task(function* setupEnvironment() {
Services.perms.add(pageURI, "uitour", Services.perms.ALLOW_ACTION);
registerCleanupFunction(() => {
Services.perms.remove("example.com", "uitour");
Services.perms.remove(pageURI, "uitour");
Preferences.set(PREF_SELFSUPPORT_ENABLED, selfSupportEnabled);
Preferences.set(PREF_UITOUR_ENABLED, uitourEnabled);
Preferences.set(PREF_SELFSUPPORT_URL, selfSupportURL);

View File

@ -749,14 +749,13 @@ function updateBrowserSpecificIndicator(aBrowser, aState) {
accessKey: stringBundle.getString("getUserMedia.stopSharing.accesskey"),
callback: function () {
let uri = Services.io.newURI(aState.documentURI, null, null);
let host = getHost(uri);
let perms = Services.perms;
if (aState.camera &&
perms.testExactPermission(uri, "camera") == perms.ALLOW_ACTION)
perms.remove(host, "camera");
perms.remove(uri, "camera");
if (aState.microphone &&
perms.testExactPermission(uri, "microphone") == perms.ALLOW_ACTION)
perms.remove(host, "microphone");
perms.remove(uri, "microphone");
let mm = notification.browser.messageManager;
mm.sendAsyncMessage("webrtc:StopSharing", windowId);

View File

@ -2913,6 +2913,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):hover:active,
#TabsToolbar .toolbarbutton-1:not([type="menu-button"]):not([disabled=true]):hover:active,
#TabsToolbar .toolbarbutton-1[type="menu"][open],
#TabsToolbar .toolbarbutton-1[type="panel"][open],
#TabsToolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled=true]):hover:active,
#TabsToolbar .toolbarbutton-1[open]:not([disabled=true]):hover > .toolbarbutton-menubutton-dropmarker {
background-image: linear-gradient(transparent, rgba(0,0,0,.3)) !important;

View File

@ -642,6 +642,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
-moz-padding-end: 5px;
}
#nav-bar .toolbarbutton-1[type=panel]:not(#back-button):not(#forward-button):not(#feed-button):not(#PanelUI-menu-button),
#nav-bar .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button):not(#PanelUI-menu-button) {
padding-left: 5px;
padding-right: 5px;
@ -753,7 +754,10 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
width: 32px;
}
#nav-bar .toolbarbutton-1[type=panel]:not(#back-button):not(#forward-button):not(#feed-button):not(#PanelUI-menu-button) > .toolbarbutton-icon,
#nav-bar .toolbarbutton-1[type=panel]:not(#back-button):not(#forward-button):not(#feed-button):not(#PanelUI-menu-button) > .toolbarbutton-badge-container,
#nav-bar .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button):not(#PanelUI-menu-button) > .toolbarbutton-icon,
#nav-bar .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button):not(#PanelUI-menu-button) > .toolbarbutton-badge-container,
#nav-bar .toolbarbutton-1[type=menu] > .toolbarbutton-text /* hack for add-ons that forcefully display the label */ {
-moz-padding-end: 17px;
}

View File

@ -22,7 +22,7 @@ static nsresult
BroadcastDomainSetChange(DomainSetType aSetType, DomainSetChangeType aChangeType,
nsIURI* aDomain = nullptr)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default,
MOZ_ASSERT(XRE_IsParentProcess(),
"DomainPolicy should only be exposed to the chrome process.");
nsTArray<ContentParent*> parents;
@ -45,7 +45,7 @@ DomainPolicy::DomainPolicy() : mBlacklist(new DomainSet(BLACKLIST))
, mWhitelist(new DomainSet(WHITELIST))
, mSuperWhitelist(new DomainSet(SUPER_WHITELIST))
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
BroadcastDomainSetChange(NO_TYPE, ACTIVATE_POLICY);
}
}
@ -112,7 +112,7 @@ DomainPolicy::Deactivate()
if (ssm) {
ssm->DeactivateDomainPolicy();
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
BroadcastDomainSetChange(NO_TYPE, DEACTIVATE_POLICY);
}
return NS_OK;
@ -170,7 +170,7 @@ DomainSet::Add(nsIURI* aDomain)
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.PutEntry(clone);
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
return BroadcastDomainSetChange(mType, ADD_DOMAIN, aDomain);
return NS_OK;
@ -182,7 +182,7 @@ DomainSet::Remove(nsIURI* aDomain)
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.RemoveEntry(clone);
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
return BroadcastDomainSetChange(mType, REMOVE_DOMAIN, aDomain);
return NS_OK;
@ -192,7 +192,7 @@ NS_IMETHODIMP
DomainSet::Clear()
{
mHashTable.Clear();
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
return BroadcastDomainSetChange(mType, CLEAR_DOMAINS);
return NS_OK;

View File

@ -1283,7 +1283,7 @@ nsScriptSecurityManager::~nsScriptSecurityManager(void)
// ContentChild might hold a reference to the domain policy,
// and it might release it only after the security manager is
// gone. But we can still assert this for the main process.
MOZ_ASSERT_IF(XRE_GetProcessType() == GeckoProcessType_Default,
MOZ_ASSERT_IF(XRE_IsParentProcess(),
!mDomainPolicy);
}
@ -1500,7 +1500,7 @@ nsScriptSecurityManager::GetDomainPolicyActive(bool *aRv)
NS_IMETHODIMP
nsScriptSecurityManager::ActivateDomainPolicy(nsIDomainPolicy** aRv)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return NS_ERROR_SERVICE_NOT_AVAILABLE;
}

View File

@ -416,7 +416,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
}
keyword.Trim(" ");
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (!contentChild) {
return NS_ERROR_NOT_AVAILABLE;

View File

@ -824,7 +824,7 @@ IncreasePrivateDocShellCount()
{
gNumberOfPrivateDocShells++;
if (gNumberOfPrivateDocShells > 1 ||
XRE_GetProcessType() != GeckoProcessType_Content) {
!XRE_IsContentProcess()) {
return;
}
@ -838,7 +838,7 @@ DecreasePrivateDocShellCount()
MOZ_ASSERT(gNumberOfPrivateDocShells > 0);
gNumberOfPrivateDocShells--;
if (!gNumberOfPrivateDocShells) {
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* cc = dom::ContentChild::GetSingleton();
cc->SendPrivateDocShellsExist(false);
return;
@ -5020,7 +5020,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
mInPrivateBrowsing ? nsISocketProvider::NO_PERMANENT_STORAGE : 0;
bool isStsHost = false;
bool isPinnedHost = false;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsISiteSecurityService> sss =
do_GetService(NS_SSSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -9448,7 +9448,7 @@ nsDocShell::CopyFavicon(nsIURI* aOldURI,
nsIURI* aNewURI,
bool aInPrivateBrowsing)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
mozilla::ipc::URIParams oldURI, newURI;
@ -13991,7 +13991,7 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
return;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
contentChild->SendNotifyKeywordSearchLoading(aProvider, aKeyword);

View File

@ -57,12 +57,6 @@ namespace asmjscache {
namespace {
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
// Anything smaller should compile fast enough that caching will just add
// overhead.
static const size_t sMinCachedModuleLength = 10000;
@ -504,7 +498,7 @@ public:
mIsApp(false),
mEnforcingQuota(true)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
}
virtual ~MainProcessRunnable()
@ -1147,7 +1141,7 @@ public:
: MainProcessRunnable(aPrincipal, aOpenMode, aWriteParams),
mReadParams(aReadParams)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(!NS_IsMainThread());
MOZ_COUNT_CTOR(SingleProcessRunnable);
}
@ -1229,7 +1223,7 @@ public:
mOpened(false),
mFinished(false)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_COUNT_CTOR(ParentProcessRunnable);
}
@ -1408,7 +1402,7 @@ public:
mActorDestroyed(false),
mState(eInitial)
{
MOZ_ASSERT(!IsMainProcess());
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(!NS_IsMainThread());
MOZ_COUNT_CTOR(ChildProcessRunnable);
}
@ -1604,7 +1598,7 @@ OpenFile(nsIPrincipal* aPrincipal,
// parent process to open the file and interact with the QuotaManager. The
// child can then map the file into its address space to perform I/O.
nsRefPtr<File> file;
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
file = new SingleProcessRunnable(aPrincipal, aOpenMode, aWriteParams,
aReadParams);
} else {

View File

@ -70,7 +70,7 @@ AudioChannelService::GetAudioChannelService()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return AudioChannelServiceChild::GetAudioChannelService();
}
@ -84,7 +84,7 @@ AudioChannelService::GetOrCreateAudioChannelService()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return AudioChannelServiceChild::GetOrCreateAudioChannelService();
}
@ -104,7 +104,7 @@ AudioChannelService::GetOrCreateAudioChannelService()
void
AudioChannelService::Shutdown()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return AudioChannelServiceChild::Shutdown();
}
@ -122,7 +122,7 @@ AudioChannelService::AudioChannelService()
, mDisabled(false)
, mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->AddObserver(this, "ipc:content-shutdown", false);
@ -180,7 +180,7 @@ AudioChannelService::RegisterType(AudioChannel aChannel, uint64_t aChildID,
AudioChannelInternalType type = GetInternalType(aChannel, true);
mChannelCounters[type].AppendElement(aChildID);
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// We must keep the childIds in order to decide which app is allowed to play
// with then telephony channel.
@ -272,7 +272,7 @@ AudioChannelService::UnregisterType(AudioChannel aChannel,
// There are two reasons to defer the decrease of telephony channel.
// 1. User can have time to remove device from his ear before music resuming.
// 2. Give BT SCO to be disconnected before starting to connect A2DP.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
if (aChannel == AudioChannel::Telephony) {
UnregisterTelephonyChild(aChildID);
@ -306,7 +306,7 @@ AudioChannelService::UnregisterTypeInternal(AudioChannel aChannel,
// In order to avoid race conditions, it's safer to notify any existing
// agent any time a new one is registered.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// No hidden content channel is playable if the original playable hidden
// process does not need to play audio from background anymore.
if (aChannel == AudioChannel::Content &&
@ -547,7 +547,7 @@ AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
bool aVisible,
uint64_t aChildID)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}
@ -590,7 +590,7 @@ AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
void
AudioChannelService::SendAudioChannelChangedNotification(uint64_t aChildID)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}

View File

@ -91,7 +91,7 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
uint8_t* data = aArray.Data();
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
InfallibleTArray<uint8_t> randomValues;
// Tell the parent process to generate random values via PContent
ContentChild* cc = ContentChild::GetSingleton();

View File

@ -1481,7 +1481,7 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
#if defined(XP_LINUX)
if (aName.EqualsLiteral("hardware.memory")) {
// with seccomp enabled, fopen() should be in a non-sandboxed process
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
uint32_t memLevel = mozilla::hal::GetTotalSystemMemoryLevel();
if (memLevel == 0) {
p->MaybeReject(NS_ERROR_NOT_AVAILABLE);
@ -2549,7 +2549,7 @@ Navigator::HasTVSupport(JSContext* aCx, JSObject* aGlobal)
bool
Navigator::IsE10sEnabled(JSContext* aCx, JSObject* aGlobal)
{
return XRE_GetProcessType() == GeckoProcessType_Content;
return XRE_IsContentProcess();
}
bool

View File

@ -141,7 +141,7 @@ static void
MarkMessageManagers()
{
// The global message manager only exists in the root process.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}
nsCOMPtr<nsIMessageBroadcaster> strongGlobalMM =

View File

@ -336,7 +336,7 @@ nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest, n
NS_ENSURE_STATE(aWindow && aWindow->IsCurrentInnerWindow());
// for content process
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
nsRefPtr<RemotePermissionRequest> req =
new RemotePermissionRequest(aRequest, aWindow);

View File

@ -10658,7 +10658,7 @@ PLDHashOperator UnlockEnumerator(imgIRequest* aKey,
nsresult
nsDocument::SetImageLockingState(bool aLocked)
{
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
!Preferences::GetBool("image.mem.allow_locking_in_content_processes", true)) {
return NS_OK;
}
@ -11161,8 +11161,17 @@ ExitFullscreenInDocTree(nsIDocument* aMaybeNotARootDoc)
if (!root) {
return;
}
NS_ASSERTION(root->IsFullScreenDoc(),
"Fullscreen root should be a fullscreen doc...");
if (!root->IsFullScreenDoc()) {
// If a document was detached before exiting from fullscreen, it is
// possible that the root had left fullscreen state. In this case,
// we would not get anything from the ResetFullScreen() call. Root's
// not being a fullscreen doc also means the widget should have
// exited fullscreen state. It means even if we do not return here,
// we would actually do nothing below except crashing ourselves via
// dispatching the "MozDOMFullscreen:Exited" event to an nonexistent
// document.
return;
}
// Stores a list of documents to which we must dispatch "mozfullscreenchange".
// We're required by the spec to dispatch the events in leaf-to-root

View File

@ -697,7 +697,7 @@ nsFocusManager::WindowRaised(nsIDOMWindow* aWindow)
// If this is a parent or single process window, send the activate event.
// Events for child process windows will be sent when ParentActivated
// is called.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ActivateOrDeactivate(window, true);
}
@ -760,7 +760,7 @@ nsFocusManager::WindowLowered(nsIDOMWindow* aWindow)
// If this is a parent or single process window, send the deactivate event.
// Events for child process windows will be sent when ParentActivated
// is called.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ActivateOrDeactivate(window, false);
}

View File

@ -1600,12 +1600,12 @@ nsFrameLoader::ShouldUseRemoteProcess()
// Don't try to launch nested children if we don't have OMTC.
// They won't render!
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
!CompositorChild::ChildProcessHasCompositor()) {
return false;
}
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
!(PR_GetEnv("MOZ_NESTED_OOP_TABS") ||
Preferences::GetBool("dom.ipc.tabs.nested.enabled", false))) {
return false;
@ -2649,7 +2649,7 @@ nsFrameLoader::ResetPermissionManagerStatus()
{
// The resetting of the permissions status can run only
// in the main process.
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return;
}

View File

@ -902,7 +902,7 @@ nsFrameMessageManager::Dump(const nsAString& aStr)
NS_IMETHODIMP
nsFrameMessageManager::PrivateNoteIntentionalCrash()
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
mozilla::NoteIntentionalCrash("tab");
return NS_OK;
} else {
@ -1576,7 +1576,7 @@ MessageManagerReporter::CollectReports(nsIMemoryReporterCallback* aCb,
{
nsresult rv;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIMessageBroadcaster> globalmm =
do_GetService("@mozilla.org/globalmessagemanager;1");
if (globalmm) {
@ -1612,7 +1612,7 @@ MessageManagerReporter::CollectReports(nsIMemoryReporterCallback* aCb,
nsresult
NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
{
NS_ENSURE_TRUE(XRE_GetProcessType() == GeckoProcessType_Default,
NS_ENSURE_TRUE(XRE_IsParentProcess(),
NS_ERROR_NOT_AVAILABLE);
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(nullptr,
nullptr,
@ -2141,7 +2141,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
"Re-creating sChildProcessManager");
MessageManagerCallback* cb;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
cb = new SameChildProcessMessageManagerCallback();
} else {
cb = new ChildProcessMessageManagerCallback();

View File

@ -8960,7 +8960,7 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
(aUrl, aArgument, aOptions, aError), aError,
nullptr);
if (!IsShowModalDialogEnabled() || XRE_GetProcessType() == GeckoProcessType_Content) {
if (!IsShowModalDialogEnabled() || XRE_IsContentProcess()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
@ -10749,7 +10749,7 @@ nsGlobalWindow::ShowSlowScriptDialog()
unsigned lineno;
bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
ProcessHangMonitor::Get()) {
ProcessHangMonitor::SlowScriptAction action;
nsRefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();

View File

@ -3211,7 +3211,7 @@ nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentTyp
sPrefsInitialized = true;
}
if (XRE_GetProcessType() == GeckoProcessType_Default &&
if (XRE_IsParentProcess() &&
BrowserTabsRemoteAutostart()) {
// Plugins running OOP from the chrome process along with plugins running
// OOP from the content process will hang. Let's prevent that situation.

View File

@ -534,7 +534,7 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
// Collect window memory usage.
nsWindowSizes windowTotalSizes(nullptr);
nsCOMPtr<amIAddonManager> addonManager;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// Only try to access the service from the main process.
addonManager = do_GetService("@mozilla.org/addons/integration;1");
}

View File

@ -2946,7 +2946,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
if (scheme.LowerCaseEqualsLiteral("app") ||
scheme.LowerCaseEqualsLiteral("jar")) {
mIsMappedArrayBuffer = true;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIJARChannel> jarChannel = do_QueryInterface(mChannel);
// For memory mapping from child process, we need to get file
// descriptor of the JAR file opened remotely on the parent proess.

View File

@ -333,10 +333,4 @@ DispatchStatusChangedEvent(const nsAString& aType,
#endif
}
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
END_BLUETOOTH_NAMESPACE

View File

@ -157,14 +157,6 @@ DispatchStatusChangedEvent(const nsAString& aType,
const nsAString& aDeviceAddress,
bool aStatus);
/**
* Check whether the caller runs at B2G process.
*
* @return true if the caller runs at B2G process, false otherwise.
*/
bool
IsMainProcess();
END_BLUETOOTH_NAMESPACE
#endif

View File

@ -238,7 +238,7 @@ bool
BluetoothHfpManager::Init()
{
// The function must run at b2g process since it would access SettingsService.
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());

View File

@ -784,7 +784,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// In-process transfer
bs->SendFile(aDeviceAddress, &aBlob, results);
} else {

View File

@ -98,12 +98,6 @@ StaticRefPtr<BluetoothService> sBluetoothService;
bool sInShutdown = false;
bool sToggleInProgress = false;
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
void
ShutdownTimeExceeded(nsITimer* aTimer, void* aClosure)
{
@ -220,7 +214,7 @@ BluetoothService*
BluetoothService::Create()
{
#if defined(MOZ_B2G_BT)
if (!IsMainProcess()) {
if (!XRE_IsParentProcess()) {
return BluetoothServiceChildProcess::Create();
}
@ -254,7 +248,7 @@ BluetoothService::Init()
}
// Only the main process should observe bluetooth settings changes.
if (IsMainProcess() &&
if (XRE_IsParentProcess() &&
NS_FAILED(obs->AddObserver(this, MOZSETTINGS_CHANGED_ID, false))) {
BT_WARNING("Failed to add settings change observer!");
return false;

View File

@ -1266,7 +1266,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// In-process transfer
bs->SendFile(aDeviceAddress, &aBlob, results);
} else {

View File

@ -193,7 +193,7 @@ BluetoothService*
BluetoothService::Create()
{
#if defined(MOZ_B2G_BT)
if (!IsMainProcess()) {
if (!XRE_IsParentProcess()) {
return BluetoothServiceChildProcess::Create();
}
@ -227,7 +227,7 @@ BluetoothService::Init()
}
// Only the main process should observe bluetooth settings changes.
if (IsMainProcess() &&
if (XRE_IsParentProcess() &&
NS_FAILED(obs->AddObserver(this, MOZSETTINGS_CHANGED_ID, false))) {
BT_WARNING("Failed to add settings change observer!");
return false;
@ -269,7 +269,7 @@ BluetoothService::RegisterBluetoothSignalHandler(
// Distribute pending pairing requests when pairing listener has been added
// to signal observer table.
if (IsMainProcess() &&
if (XRE_IsParentProcess() &&
!mPendingPairReqSignals.IsEmpty() &&
aNodeName.EqualsLiteral(KEY_PAIRING_LISTENER)) {
for (uint32_t i = 0; i < mPendingPairReqSignals.Length(); ++i) {

View File

@ -443,7 +443,7 @@ bool
BluetoothHfpManager::Init()
{
// The function must run at b2g process since it would access SettingsService.
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();

View File

@ -152,7 +152,7 @@ NS_CreateCellBroadcastService()
{
nsCOMPtr<nsICellBroadcastService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::cellbroadcast::CellBroadcastIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {

View File

@ -51,8 +51,8 @@
#include "nsXULAppAPI.h"
#define ASSERT_PARENT_PROCESS() \
AssertIsInMainProcess(); \
if (NS_WARN_IF(!IsMainProcess())) { \
MOZ_ASSERT(XRE_IsParentProcess()); \
if (NS_WARN_IF(!XRE_IsParentProcess())) { \
return NS_ERROR_FAILURE; \
}
@ -125,20 +125,6 @@ static uint64_t gCounterID = 0;
typedef nsClassHashtable<nsUint32HashKey, DataStoreInfo> HashApp;
bool
IsMainProcess()
{
static const bool isMainProcess =
XRE_GetProcessType() == GeckoProcessType_Default;
return isMainProcess;
}
void
AssertIsInMainProcess()
{
MOZ_ASSERT(IsMainProcess());
}
void
RejectPromise(nsPIDOMWindow* aWindow, Promise* aPromise, nsresult aRv)
{
@ -161,8 +147,7 @@ void
DeleteDatabase(const nsAString& aName,
const nsAString& aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<DataStoreDB> db = new DataStoreDB(aManifestURL, aName);
db->Delete();
@ -174,8 +159,7 @@ DeleteDataStoresAppEnumerator(
nsAutoPtr<DataStoreInfo>& aInfo,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* appId = static_cast<uint32_t*>(aUserData);
if (*appId != aAppId) {
@ -191,8 +175,7 @@ DeleteDataStoresEnumerator(const nsAString& aName,
nsAutoPtr<HashApp>& aApps,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
aApps->Enumerate(DeleteDataStoresAppEnumerator, aUserData);
return aApps->Count() ? PL_DHASH_NEXT : PL_DHASH_REMOVE;
@ -215,8 +198,7 @@ ResetPermission(uint32_t aAppId, const nsAString& aOriginURL,
const nsAString& aPermission,
bool aReadOnly)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsresult rv;
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
@ -347,8 +329,7 @@ GetDataStoreInfosEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* data = static_cast<GetDataStoreInfosData*>(aUserData);
if (aAppId == data->mAppId) {
@ -384,8 +365,7 @@ GetAppManifestURLsEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* manifestURLs = static_cast<nsIMutableArray*>(aUserData);
nsCOMPtr<nsISupportsString> manifestURL(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
@ -417,8 +397,7 @@ AddPermissionsEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* userData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* data = static_cast<AddPermissionsData*>(userData);
@ -457,8 +436,7 @@ AddAccessPermissionsEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* userData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* data = static_cast<AddAccessPermissionsData*>(userData);
@ -517,15 +495,13 @@ public:
, mName(aName)
, mManifestURL(aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
}
void
Run(const nsAString& aRevisionId)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<DataStoreService> service = DataStoreService::Get();
MOZ_ASSERT(service);
@ -553,15 +529,13 @@ public:
, mName(aName)
, mManifestURL(aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
}
void
Run(DataStoreDB* aDb, RunStatus aStatus) override
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
MOZ_ASSERT(aDb);
if (aStatus == Error) {
@ -642,8 +616,7 @@ public:
NS_IMETHOD
HandleEvent(nsIDOMEvent* aEvent) override
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<IDBRequest> request;
request.swap(mRequest);
@ -830,7 +803,7 @@ DataStoreService::Shutdown()
MOZ_ASSERT(NS_IsMainThread());
if (gDataStoreService) {
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->RemoveObserver(gDataStoreService, "webapps-clear-data");
@ -863,7 +836,7 @@ DataStoreService::~DataStoreService()
nsresult
DataStoreService::Init()
{
if (!IsMainProcess()) {
if (!XRE_IsParentProcess()) {
return NS_OK;
}
@ -973,7 +946,7 @@ DataStoreService::GetDataStores(nsIDOMWindow* aWindow,
// If this request comes from the main process, we have access to the
// window, so we can skip the ipc communication.
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
uint32_t appId;
nsresult rv = principal->GetAppId(&appId);
if (NS_FAILED(rv)) {
@ -1132,8 +1105,7 @@ DataStoreService::GetDataStoreInfos(const nsAString& aName,
nsIPrincipal* aPrincipal,
nsTArray<DataStoreInfo>& aStores)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsCOMPtr<nsIAppsService> appsService =
do_GetService("@mozilla.org/AppsService;1");
@ -1242,8 +1214,7 @@ DataStoreService::CheckPermission(nsIPrincipal* aPrincipal,
void
DataStoreService::DeleteDataStores(uint32_t aAppId)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
mStores.Enumerate(DeleteDataStoresEnumerator, &aAppId);
mAccessStores.Enumerate(DeleteDataStoresEnumerator, &aAppId);
@ -1254,8 +1225,7 @@ DataStoreService::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
if (strcmp(aTopic, "webapps-clear-data")) {
return NS_OK;
@ -1294,8 +1264,7 @@ DataStoreService::AddPermissions(uint32_t aAppId,
const nsAString& aManifestURL,
bool aReadOnly)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
// This is the permission name.
nsString permission;
@ -1327,8 +1296,7 @@ DataStoreService::AddAccessPermissions(uint32_t aAppId, const nsAString& aName,
const nsAString& aManifestURL,
bool aReadOnly)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
// When an app wants to have access to a DataStore, the permissions must be
// set.
@ -1349,8 +1317,7 @@ DataStoreService::CreateFirstRevisionId(uint32_t aAppId,
const nsAString& aName,
const nsAString& aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<DataStoreDB> db = new DataStoreDB(aManifestURL, aName);
@ -1380,7 +1347,7 @@ DataStoreService::EnableDataStore(uint32_t aAppId, const nsAString& aName,
}
// Notify the child processes.
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
nsTArray<ContentParent*> children;
ContentParent::GetAll(children);
for (uint32_t i = 0; i < children.Length(); i++) {
@ -1447,8 +1414,7 @@ DataStoreService::GetDataStoresFromIPC(const nsAString& aName,
nsIPrincipal* aPrincipal,
nsTArray<DataStoreSetting>* aValue)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
uint32_t appId;
nsresult rv = aPrincipal->GetAppId(&appId);

View File

@ -561,7 +561,7 @@ FileUpdateDispatcher::Observe(nsISupports* aSubject,
return NS_OK;
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
// Child process. Forward the notification to the parent.
ContentChild::GetSingleton()
->SendFilePathUpdateNotify(dsf->mStorageType,
@ -692,7 +692,7 @@ DeviceStorageFile::Dump(const char* label)
path = NS_LITERAL_STRING("(null)");
}
const char* ptStr;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ptStr = "parent";
} else {
ptStr = "child";
@ -814,7 +814,7 @@ OverrideRootDir::Init()
}
if (sDirs->overrideRootDir) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// Only the parent process can create directories. In testing, because
// the preference is updated after startup, its entirely possible that
// the preference updated notification will be received by a child
@ -936,7 +936,7 @@ InitDirs()
}
#endif
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
NS_GetSpecialDirectory("UAppData", getter_AddRefs(sDirs->crashes));
if (sDirs->crashes) {
sDirs->crashes->Append(NS_LITERAL_STRING("Crash Reports"));
@ -2058,7 +2058,7 @@ ContinueCursorEvent::~ContinueCursorEvent() {}
void
ContinueCursorEvent::Continue()
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
DebugOnly<nsresult> rv = NS_DispatchToMainThread(this);
MOZ_ASSERT(NS_SUCCEEDED(rv));
return;
@ -2244,7 +2244,7 @@ nsDOMDeviceStorageCursor::Allow(JS::HandleValue aChoices)
return NS_DispatchToMainThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(this, mFile);
DeviceStorageEnumerationParams params(mFile->mStorageType,
@ -3013,7 +3013,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
DeviceStorageCreateFdParams params;
params.type() = mFile->mStorageType;
@ -3053,7 +3053,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
BlobChild* actor
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(
static_cast<Blob*>(mBlob.get()));
@ -3099,7 +3099,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
BlobChild* actor
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(
static_cast<Blob*>(mBlob.get()));
@ -3145,7 +3145,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageGetParams params(mFile->mStorageType,
@ -3179,7 +3179,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageDeleteParams params(mFile->mStorageType,
@ -3195,7 +3195,7 @@ public:
case DEVICE_STORAGE_REQUEST_FREE_SPACE:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageFreeSpaceParams params(mFile->mStorageType,
@ -3210,7 +3210,7 @@ public:
case DEVICE_STORAGE_REQUEST_USED_SPACE:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageUsedSpaceParams params(mFile->mStorageType,
@ -3231,7 +3231,7 @@ public:
case DEVICE_STORAGE_REQUEST_AVAILABLE:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageAvailableParams params(mFile->mStorageType,
@ -3246,7 +3246,7 @@ public:
case DEVICE_STORAGE_REQUEST_STATUS:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageStatusParams params(mFile->mStorageType,
@ -3267,7 +3267,7 @@ public:
case DEVICE_STORAGE_REQUEST_FORMAT:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageFormatParams params(mFile->mStorageType,
@ -3282,7 +3282,7 @@ public:
case DEVICE_STORAGE_REQUEST_MOUNT:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageMountParams params(mFile->mStorageType,
@ -3297,7 +3297,7 @@ public:
case DEVICE_STORAGE_REQUEST_UNMOUNT:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageUnmountParams params(mFile->mStorageType,

View File

@ -597,7 +597,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// window edge) wont update the cursor if the cached value and the current
// cursor match. So when the mouse exits a remote frame, clear the cached
// widget cursor so a proper update will occur when the mouse re-enters.
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ClearCachedWidgetCursor(mCurrentTarget);
}

View File

@ -1064,7 +1064,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
// XXX I think that we should use nsContentUtils::IsCallerChrome() instead
// of the process type.
if (aAction.mCause == InputContextAction::CAUSE_UNKNOWN &&
XRE_GetProcessType() != GeckoProcessType_Content) {
!XRE_IsContentProcess()) {
aAction.mCause = InputContextAction::CAUSE_UNKNOWN_CHROME;
}

View File

@ -242,7 +242,7 @@ void
FileInputStreamWrapper::Serialize(InputStreamParams& aParams,
FileDescriptorArray& /* aFDs */)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIInputStream> thisStream = do_QueryObject(this);

View File

@ -39,7 +39,7 @@ CreateDirectoryTask::CreateDirectoryTask(
FileSystemRequestParent* aParent)
: FileSystemTaskBase(aFileSystem, aParam, aParent)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -84,7 +84,7 @@ CreateDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& aVal
nsresult
CreateDirectoryTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");

View File

@ -39,7 +39,7 @@ CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem,
MOZ_ASSERT(aFileSystem);
GetOutputBufferSize();
if (aBlobData) {
if (FileSystemUtils::IsParentProcess()) {
if (XRE_IsParentProcess()) {
aBlobData->GetInternalStream(getter_AddRefs(mBlobStream), aRv);
NS_WARN_IF(aRv.Failed());
} else {
@ -61,7 +61,7 @@ CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem,
: FileSystemTaskBase(aFileSystem, aParam, aParent)
, mReplace(false)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -168,7 +168,7 @@ CreateFileTask::Work()
nsCOMPtr<nsIOutputStream> mStream;
};
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");
@ -324,7 +324,7 @@ CreateFileTask::GetPermissionAccessType(nsCString& aAccess) const
void
CreateFileTask::GetOutputBufferSize() const
{
if (sOutputBufferSize || !FileSystemUtils::IsParentProcess()) {
if (sOutputBufferSize || !XRE_IsParentProcess()) {
return;
}
sOutputBufferSize =

View File

@ -47,7 +47,7 @@ DeviceStorageFileSystem::DeviceStorageFileSystem(
// Get the local path of the file system root.
// Since the child process is not allowed to access the file system, we only
// do this from the parent process.
if (!FileSystemUtils::IsParentProcess()) {
if (!XRE_IsParentProcess()) {
return;
}
nsCOMPtr<nsIFile> rootFile;
@ -100,7 +100,7 @@ DeviceStorageFileSystem::GetWindow() const
already_AddRefed<nsIFile>
DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Should be on parent process!");
nsAutoString localPath;
FileSystemUtils::NormalizedPathToLocalPath(aRealPath, localPath);
@ -116,7 +116,7 @@ DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const
bool
DeviceStorageFileSystem::GetRealPath(BlobImpl* aFile, nsAString& aRealPath) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Should be on parent process!");
MOZ_ASSERT(aFile, "aFile Should not be null.");
@ -141,7 +141,7 @@ DeviceStorageFileSystem::GetRootName() const
bool
DeviceStorageFileSystem::IsSafeFile(nsIFile* aFile) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Should be on parent process!");
MOZ_ASSERT(aFile);

View File

@ -35,7 +35,7 @@ FileSystemTaskBase::FileSystemTaskBase(FileSystemBase* aFileSystem,
, mFileSystem(aFileSystem)
, mRequestParent(aParent)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem, "aFileSystem should not be null.");
@ -61,7 +61,7 @@ FileSystemTaskBase::Start()
return;
}
if (FileSystemUtils::IsParentProcess()) {
if (XRE_IsParentProcess()) {
// Run in parent process.
// Start worker thread.
nsCOMPtr<nsIEventTarget> target
@ -121,7 +121,7 @@ FileSystemTaskBase::HandleResult()
FileSystemResponseValue
FileSystemTaskBase::GetRequestResult() const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
if (HasError()) {
@ -134,7 +134,7 @@ FileSystemTaskBase::GetRequestResult() const
void
FileSystemTaskBase::SetRequestResult(const FileSystemResponseValue& aValue)
{
MOZ_ASSERT(!FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(!XRE_IsParentProcess(),
"Only call from child process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
if (aValue.type() == FileSystemResponseValue::TFileSystemErrorResponse) {
@ -156,7 +156,7 @@ FileSystemTaskBase::Recv__delete__(const FileSystemResponseValue& aValue)
BlobParent*
FileSystemTaskBase::GetBlobParent(BlobImpl* aFile) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFile);

View File

@ -65,12 +65,5 @@ FileSystemUtils::IsDescendantPath(const nsAString& aPath,
return true;
}
// static
bool
FileSystemUtils::IsParentProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
} // namespace dom
} // namespace mozilla

View File

@ -41,9 +41,6 @@ public:
static bool
IsDescendantPath(const nsAString& aPath, const nsAString& aDescendantPath);
static bool
IsParentProcess();
static const char16_t kSeparatorChar = char16_t('/');
};

View File

@ -42,7 +42,7 @@ GetDirectoryListingTask::GetDirectoryListingTask(FileSystemBase* aFileSystem,
FileSystemRequestParent* aParent)
: FileSystemTaskBase(aFileSystem, aParam, aParent)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -105,7 +105,7 @@ GetDirectoryListingTask::SetSuccessRequestResult(const FileSystemResponseValue&
nsresult
GetDirectoryListingTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");
@ -222,7 +222,7 @@ GetDirectoryListingTask::HandlerCallback()
path.AppendLiteral(FILESYSTEM_DOM_PATH_SEPARATOR);
path.Append(name);
#ifdef DEBUG
if (FileSystemUtils::IsParentProcess()) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIFile> file = mFileSystem->GetLocalFile(path);
bool exist;
file->Exists(&exist);

View File

@ -47,7 +47,7 @@ GetFileOrDirectoryTask::GetFileOrDirectoryTask(
: FileSystemTaskBase(aFileSystem, aParam, aParent)
, mIsDirectory(false)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -119,7 +119,7 @@ GetFileOrDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& a
nsresult
GetFileOrDirectoryTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");

View File

@ -49,7 +49,7 @@ RemoveTask::RemoveTask(FileSystemBase* aFileSystem,
, mRecursive(false)
, mReturnValue(false)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -123,7 +123,7 @@ RemoveTask::SetSuccessRequestResult(const FileSystemResponseValue& aValue)
nsresult
RemoveTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");

View File

@ -42,7 +42,7 @@ BEGIN_FMRADIO_NAMESPACE
IFMRadioService*
IFMRadioService::Singleton()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return FMRadioChild::Singleton();
} else {
return FMRadioService::Singleton();
@ -1243,7 +1243,7 @@ FMRadioService::UpdateFrequency()
FMRadioService*
FMRadioService::Singleton()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
if (!sFMRadioService) {

View File

@ -338,7 +338,7 @@ FMRadioChild::EnableAudio(bool aAudioEnabled)
FMRadioChild*
FMRadioChild::Singleton()
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
if (!sFMRadioChild) {

View File

@ -24,7 +24,7 @@ void
NotifyGamepadChange(const T& aInfo)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadChangeEvent e(aInfo);
nsTArray<ContentParent*> t;
ContentParent::GetAll(t);
@ -44,7 +44,7 @@ AddGamepad(const char* aID,
uint32_t aNumButtons, uint32_t aNumAxes)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
int index = gGamepadIndex;
gGamepadIndex++;
@ -59,7 +59,7 @@ void
RemoveGamepad(uint32_t aIndex)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadRemoved a(aIndex);
NotifyGamepadChange<GamepadRemoved>(a);
}
@ -69,7 +69,7 @@ NewButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed, double aValue)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadButtonInformation a(aIndex, aButton, aPressed, aValue);
NotifyGamepadChange<GamepadButtonInformation>(a);
}
@ -79,7 +79,7 @@ NewButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
// When only a digital button is available the value will be synthesized.
NewButtonEvent(aIndex, aButton, aPressed, aPressed ? 1.0L : 0.0L);
}
@ -89,7 +89,7 @@ NewAxisMoveEvent(uint32_t aIndex, uint32_t aAxis,
double aValue)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadAxisInformation a(aIndex, aAxis, aValue);
NotifyGamepadChange<GamepadAxisInformation>(a);
}
@ -98,7 +98,7 @@ void
ResetGamepadIndexes()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
gGamepadIndex = 0;
}

View File

@ -17,7 +17,7 @@ void
MaybeStopGamepadMonitoring()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
nsTArray<ContentParent*> t;
ContentParent::GetAll(t);
for(uint32_t i = 0; i < t.Length(); ++i) {

View File

@ -85,7 +85,7 @@ GamepadService::BeginShutdown()
mTimer->Cancel();
}
if (mStarted) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
MaybeStopGamepadMonitoring();
} else {
ContentChild::GetSingleton()->SendGamepadListenerRemoved();
@ -115,7 +115,7 @@ GamepadService::AddListener(nsGlobalWindow* aWindow)
}
if (!mStarted && mEnabled) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
StartGamepadMonitoring();
} else {
ContentChild::GetSingleton()->SendGamepadListenerAdded();
@ -500,7 +500,7 @@ GamepadService::TimeoutHandler(nsITimer* aTimer, void* aClosure)
}
if (self->mListeners.Length() == 0) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
MaybeStopGamepadMonitoring();
} else {
ContentChild::GetSingleton()->SendGamepadListenerRemoved();

View File

@ -564,7 +564,7 @@ already_AddRefed<nsIDOMGeoPosition>
nsGeolocationRequest::AdjustedLocation(nsIDOMGeoPosition *aPosition)
{
nsCOMPtr<nsIDOMGeoPosition> pos = aPosition;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
GPSLOG("child process just copying position");
return pos.forget();
}
@ -758,7 +758,7 @@ nsresult nsGeolocationService::Init()
return NS_ERROR_FAILURE;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
sGeoInitPending = false;
return NS_OK;
}
@ -1013,7 +1013,7 @@ nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal)
// inactivivity
SetDisconnectTimer();
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendAddGeolocationListener(IPC::Principal(aPrincipal),
HighAccuracyRequested());
@ -1076,7 +1076,7 @@ nsGeolocationService::UpdateAccuracy(bool aForceHigh)
{
bool highRequired = aForceHigh || HighAccuracyRequested();
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cpc = ContentChild::GetSingleton();
if (cpc->IsAlive()) {
cpc->SendSetGeolocationHigherAccuracy(highRequired);
@ -1103,7 +1103,7 @@ nsGeolocationService::StopDevice()
mDisconnectTimer = nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendRemoveGeolocationListener();
return; // bail early

View File

@ -49,7 +49,7 @@ already_AddRefed<nsGeolocationSettings>
nsGeolocationSettings::GetGeolocationSettings()
{
// this singleton is only needed in the parent process...
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return nullptr;
}

View File

@ -746,7 +746,7 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
new UploadLastDir::ContentPrefCallback(aFilePicker, aFpCallback);
#ifdef MOZ_B2G
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
prefCallback->HandleCompletion(nsIContentPrefCallback2::COMPLETE_ERROR);
return NS_OK;
}
@ -777,7 +777,7 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
}
#ifdef MOZ_B2G
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return NS_OK;
}
#endif
@ -2105,7 +2105,7 @@ HTMLInputElement::MozSetFileArray(const Sequence<OwningNonNull<File>>& aFiles)
void
HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames, ErrorResult& aRv)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}

View File

@ -596,7 +596,7 @@ nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
// Only allow content process to embed an app when nested content
// process is enabled.
if (XRE_GetProcessType() != GeckoProcessType_Default &&
if (!XRE_IsParentProcess() &&
!(GetBoolAttr(nsGkAtoms::Remote) && NestedEnabled())){
NS_WARNING("Can't embed-apps. Embed-apps is restricted to in-proc apps "
"or content processes with nested pref enabled, see bug 1097479");

View File

@ -468,6 +468,8 @@ skip-if = toolkit == 'android'
[test_formelements.html]
[test_fullscreen-api.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT # b2g(time out, some kind of focus issue) b2g-debug(time out, some kind of focus issue) b2g-desktop(time out, some kind of focus issue)
[test_fullscreen-api-race.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || toolkit == 'cocoa' || e10s # just copy the conditions from the test above
[test_hidden.html]
[test_html_attributes_reflection.html]
[test_htmlcollection.html]

View File

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for race conditions of Fullscreen API</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script>
function Deferred() {
this.promise = new Promise(resolve => {
this.resolve = resolve;
});
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(function () {
SpecialPowers.pushPrefEnv({
"set": [["full-screen-api.allow-trusted-requests-only", false]]
}, next);
});
const OPEN_WINDOW_FUNCS = [
function openNewTab() {
return window.open("about:blank");
},
function openNewWindow() {
return window.open("about:blank", "", "width=300,height=200");
}
];
const ACTION_FUNCS = [
function navigate(win) {
info("About to navigate to another page");
var deferred = new Deferred();
win.location = "data:text/html,<html>";
setTimeout(() => {
SimpleTest.waitForFocus(() => {
ok(!win.fullScreen, "The window should no longer be in fullscreen");
win.close();
deferred.resolve();
}, win);
}, 0);
return deferred.promise;
},
function closeWindow(win) {
info("About to close the window");
win.close();
return Promise.resolve();
},
function exitFullscreen(win) {
info("About to cancel fullscreen");
var deferred = new Deferred();
function listener() {
win.removeEventListener("mozfullscreenchange", listener);
ok(!win.document.mozFullScreen, "Should exit fullscreen");
ok(!win.fullScreen, "The window should no longer be in fullscreen");
win.close();
deferred.resolve();
}
win.addEventListener("mozfullscreenchange", listener);
win.document.mozCancelFullScreen();
return deferred.promise;
},
function exitAndClose(win) {
info("About to cancel fullscreen and close the window");
win.document.mozCancelFullScreen();
win.close();
return Promise.resolve();
}
];
function* testGenerator() {
for (var openWinFunc of OPEN_WINDOW_FUNCS) {
for (var actionFunc of ACTION_FUNCS) {
info(`Testing ${openWinFunc.name}, ${actionFunc.name}`);
yield { openWinFunc: openWinFunc, actionFunc: actionFunc };
}
}
}
var tests = testGenerator();
function next() {
var test = tests.next().value;
if (!test) {
SimpleTest.finish();
return;
}
var win = test.openWinFunc();
new Promise(resolve => {
SimpleTest.waitForFocus(resolve, win, true);
}).then(() => {
return new Promise(resolve => {
function listener() {
win.removeEventListener("mozfullscreenchange", listener);
ok(win.document.mozFullScreen, "Should have entered fullscreen");
ok(win.fullScreen, "The window should be in fullscreen");
test.actionFunc(win).then(resolve);
}
win.addEventListener("mozfullscreenchange", listener);
win.document.documentElement.mozRequestFullScreen();
});
}).then(() => {
ok(win.closed, "The window should have been closed");
SimpleTest.waitForFocus(next);
});
}
</script>
</body>
</html>

View File

@ -143,7 +143,7 @@ NS_CreateIccService()
{
nsCOMPtr<nsIIccService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::icc::IccIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {

View File

@ -818,7 +818,7 @@ public:
: PermissionRequestBase(aElement, aPrincipal)
, mChallenge(aChallenge)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aChallenge);
}
@ -844,7 +844,7 @@ public:
WorkerPermissionChallenge* aChallenge)
: mChallenge(aChallenge)
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aChallenge);
}
@ -950,7 +950,7 @@ private:
return true;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<Element> ownerElement =
do_QueryInterface(window->GetChromeEventHandler());
if (NS_WARN_IF(!ownerElement)) {
@ -1399,7 +1399,7 @@ BackgroundFactoryRequestChild::RecvPermissionChallenge(
return false;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsPIDOMWindow> window = mFactory->GetParentObject();
MOZ_ASSERT(window);

View File

@ -83,7 +83,7 @@ BlobImplSnapshot::~BlobImplSnapshot()
void
BlobImplSnapshot::AssertSanity()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
}

View File

@ -302,7 +302,7 @@ IndexedDatabaseManager::GetOrCreate()
}
if (!gDBManager) {
sIsMainProcess = XRE_GetProcessType() == GeckoProcessType_Default;
sIsMainProcess = XRE_IsParentProcess();
if (!sLoggingModule) {
sLoggingModule = PR_NewLogModule("IndexedDB");
@ -639,7 +639,7 @@ IndexedDatabaseManager::IsMainProcess()
{
NS_ASSERTION(gDBManager,
"IsMainProcess() called before indexedDB has been initialized!");
NS_ASSERTION((XRE_GetProcessType() == GeckoProcessType_Default) ==
NS_ASSERTION((XRE_IsParentProcess()) ==
sIsMainProcess, "XRE_GetProcessType changed its tune!");
return sIsMainProcess;
}

View File

@ -43,7 +43,7 @@ const uint32_t kPermissionDefault = nsIPermissionManager::UNKNOWN_ACTION;
void
AssertSanity()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
}

View File

@ -3294,7 +3294,7 @@ BlobChild::AssertIsOnOwningThread() const
void
BlobChild::Startup(const FriendKey& /* aKey */)
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
CommonStartup();
}
@ -3822,7 +3822,7 @@ BlobParent::AssertIsOnOwningThread() const
void
BlobParent::Startup(const FriendKey& /* aKey */)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
CommonStartup();

View File

@ -2830,7 +2830,7 @@ uint64_t
NextWindowID()
{
uint64_t processID = 0;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cc = ContentChild::GetSingleton();
processID = cc->GetID();
}

View File

@ -778,7 +778,7 @@ ContentParent::StartUp()
// child process
sCanLaunchSubprocesses = true;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}
@ -1152,7 +1152,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
}
ProcessPriority initialPriority = GetInitialProcessPriority(aFrameElement);
bool isInContentProcess = (XRE_GetProcessType() != GeckoProcessType_Default);
bool isInContentProcess = !XRE_IsParentProcess();
TabId tabId;
nsIDocShell* docShell = GetOpenerDocShellHelper(aFrameElement);
@ -1811,7 +1811,7 @@ ContentParent::OnChannelError()
void
ContentParent::OnBeginSyncTransaction() {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (!sDisableUnsafeCPOWWarnings) {
@ -4895,7 +4895,7 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
const ContentParentId& aCpId)
{
TabId tabId;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
tabId = cpm->AllocateTabId(aOpenerTabId, aContext, aCpId);
}
@ -4912,7 +4912,7 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
ContentParent::DeallocateTabId(const TabId& aTabId,
const ContentParentId& aCpId)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ContentProcessManager::GetSingleton()->DeallocateTabId(aCpId,
aTabId);
}
@ -5111,7 +5111,7 @@ ContentParent::DeallocPContentPermissionRequestParent(PContentPermissionRequestP
bool
ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration* aConfig)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
return GetBrowserConfiguration(aURI, *aConfig);;
}
@ -5119,7 +5119,7 @@ ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfigu
/*static*/ bool
ContentParent::GetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration& aConfig)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsRefPtr<ServiceWorkerRegistrar> swr = ServiceWorkerRegistrar::Get();
MOZ_ASSERT(swr);

View File

@ -32,7 +32,7 @@ ContentProcessManager::sSingleton;
/* static */ ContentProcessManager*
ContentProcessManager::GetSingleton()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (!sSingleton) {
sSingleton = new ContentProcessManager();

View File

@ -887,7 +887,7 @@ ProcessHangMonitor::ProcessHangMonitor()
MOZ_COUNT_CTOR(ProcessHangMonitor);
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
obs->AddObserver(this, "xpcom-shutdown", false);
}

View File

@ -384,7 +384,7 @@ ProcessPriorityManagerImpl::StaticInit()
}
// The process priority manager is main-process only.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
sInitialized = true;
return;
}
@ -427,7 +427,7 @@ ProcessPriorityManagerImpl::ProcessPriorityManagerImpl()
, mBackgroundLRUPool(PROCESS_PRIORITY_BACKGROUND)
, mBackgroundPerceivableLRUPool(PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
RegisterWakeLockObserver(this);
}
@ -660,7 +660,7 @@ ParticularProcessPriorityManager::ParticularProcessPriorityManager(
, mIsActivityOpener(false)
, mFrozen(aFrozen)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
LOGP("Creating ParticularProcessPriorityManager.");
}
@ -826,7 +826,7 @@ ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubjec
TabParent* tp = TabParent::GetFrom(fl);
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (tp->Manager() != mContentParent) {
return;
}
@ -850,7 +850,7 @@ ParticularProcessPriorityManager::OnTabParentDestroyed(nsISupports* aSubject)
nsCOMPtr<nsITabParent> tp = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (TabParent::GetFrom(tp)->Manager() != mContentParent) {
return;
}
@ -873,7 +873,7 @@ ParticularProcessPriorityManager::OnFrameloaderVisibleChanged(nsISupports* aSubj
return;
}
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (tp->Manager() != mContentParent) {
return;
}
@ -1213,7 +1213,7 @@ NS_IMPL_ISUPPORTS(ProcessPriorityManagerChild,
ProcessPriorityManagerChild::ProcessPriorityManagerChild()
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
mCachedPriority = PROCESS_PRIORITY_MASTER;
} else {
mCachedPriority = PROCESS_PRIORITY_UNKNOWN;
@ -1225,7 +1225,7 @@ ProcessPriorityManagerChild::Init()
{
// The process priority should only be changed in child processes; don't even
// bother listening for changes if we're in the main process.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
NS_ENSURE_TRUE_VOID(os);
os->AddObserver(this, "ipc:process-priority-changed", /* weak = */ false);

View File

@ -447,7 +447,7 @@ TabParent::Destroy()
}
mIsDestroyed = true;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
Manager()->AsContentParent()->NotifyTabDestroying(this);
}
@ -465,7 +465,7 @@ TabParent::Destroy()
bool
TabParent::Recv__delete__()
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
Manager()->AsContentParent()->NotifyTabDestroyed(this, mMarkedDestroying);
ContentParent::DeallocateTabId(mTabId,
Manager()->AsContentParent()->ChildID());

View File

@ -1478,7 +1478,7 @@ MediaManager::NotifyRecordingStatusChange(nsPIDOMWindow* aWindow,
// Forward recording events to parent process.
// The events are gathered in chrome process and used for recording indicator
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
unused <<
dom::ContentChild::GetSingleton()->SendRecordingDeviceEvents(aMsg,
requestURL,

View File

@ -636,15 +636,16 @@ CDMProxy::Capabilites() {
return mCapabilites;
}
void
CDMProxy::Decrypt(MediaRawData* aSample,
DecryptionClient* aClient,
MediaTaskQueue* aTaskQueue)
nsRefPtr<CDMProxy::DecryptPromise>
CDMProxy::Decrypt(MediaRawData* aSample)
{
nsRefPtr<DecryptJob> job(new DecryptJob(aSample, aClient, aTaskQueue));
nsRefPtr<DecryptJob> job(new DecryptJob(aSample));
nsRefPtr<DecryptPromise> promise(job->Ensure());
nsCOMPtr<nsIRunnable> task(
NS_NewRunnableMethodWithArg<nsRefPtr<DecryptJob>>(this, &CDMProxy::gmp_Decrypt, job));
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
return promise;
}
void
@ -703,7 +704,6 @@ CDMProxy::DecryptJob::PostResult(GMPErr aResult, const nsTArray<uint8_t>& aDecry
if (aDecryptedData.Length() != mSample->mSize) {
NS_WARNING("CDM returned incorrect number of decrypted bytes");
}
mResult = aResult;
if (GMP_SUCCEEDED(aResult)) {
nsAutoPtr<MediaRawDataWriter> writer(mSample->CreateWriter());
PodCopy(writer->mData,
@ -717,17 +717,8 @@ CDMProxy::DecryptJob::PostResult(GMPErr aResult, const nsTArray<uint8_t>& aDecry
nsAutoCString str("CDM returned decode failure GMPErr=");
str.AppendInt(aResult);
NS_WARNING(str.get());
mSample = nullptr;
}
mTaskQueue->Dispatch(RefPtr<nsIRunnable>(this).forget());
}
nsresult
CDMProxy::DecryptJob::Run()
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
mClient->Decrypted(mResult, mSample);
return NS_OK;
mPromise.Resolve(DecryptResult(aResult, mSample), __func__);
}
void

View File

@ -14,6 +14,7 @@
#include "nsIThread.h"
#include "GMPDecryptorProxy.h"
#include "mozilla/CDMCaps.h"
#include "MediaPromise.h"
namespace mozilla {
class MediaRawData;
@ -23,11 +24,13 @@ namespace dom {
class MediaKeySession;
}
class DecryptionClient {
public:
virtual ~DecryptionClient() {}
virtual void Decrypted(GMPErr aResult,
MediaRawData* aSample) = 0;
struct DecryptResult {
DecryptResult(GMPErr aStatus, MediaRawData* aSample)
: mStatus(aStatus)
, mSample(aSample)
{}
GMPErr mStatus;
nsRefPtr<MediaRawData> mSample;
};
// Proxies calls GMP/CDM, and proxies calls back.
@ -41,6 +44,8 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CDMProxy)
typedef MediaPromise<DecryptResult, DecryptResult, /* IsExclusive = */ true> DecryptPromise;
// Main thread only.
CDMProxy(dom::MediaKeys* aKeys, const nsAString& aKeySystem);
@ -140,10 +145,7 @@ public:
nsresult aDOMException,
const nsCString& aMsg);
// Threadsafe.
void Decrypt(MediaRawData* aSample,
DecryptionClient* aSink,
MediaTaskQueue* aTaskQueue);
nsRefPtr<DecryptPromise> Decrypt(MediaRawData* aSample);
// Reject promise with DOMException corresponding to aExceptionCode.
// Can be called from any thread.
@ -236,32 +238,28 @@ private:
// GMP thread only.
void gmp_RemoveSession(nsAutoPtr<SessionOpData> aData);
class DecryptJob : public nsRunnable {
class DecryptJob {
public:
explicit DecryptJob(MediaRawData* aSample,
DecryptionClient* aClient,
MediaTaskQueue* aTaskQueue)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DecryptJob)
explicit DecryptJob(MediaRawData* aSample)
: mId(0)
, mSample(aSample)
, mClient(aClient)
, mResult(GMPGenericErr)
, mTaskQueue(aTaskQueue)
{
MOZ_ASSERT(mClient);
MOZ_ASSERT(mSample);
}
NS_METHOD Run() override;
void PostResult(GMPErr aResult, const nsTArray<uint8_t>& aDecryptedData);
void PostResult(GMPErr aResult);
nsRefPtr<DecryptPromise> Ensure() {
return mPromise.Ensure(__func__);
}
uint32_t mId;
nsRefPtr<MediaRawData> mSample;
private:
~DecryptJob() {}
nsAutoPtr<DecryptionClient> mClient;
GMPErr mResult;
nsRefPtr<MediaTaskQueue> mTaskQueue;
MediaPromiseHolder<DecryptPromise> mPromise;
};
// GMP thread only.
void gmp_Decrypt(nsRefPtr<DecryptJob> aJob);

View File

@ -109,7 +109,7 @@ private:
MOZ_ASSERT(NS_IsMainThread());
if (!sSingletonService) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsRefPtr<GeckoMediaPluginServiceParent> service =
new GeckoMediaPluginServiceParent();
service->Init();

View File

@ -33,7 +33,7 @@ namespace gmp {
already_AddRefed<GeckoMediaPluginServiceChild>
GeckoMediaPluginServiceChild::GetSingleton()
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
nsRefPtr<GeckoMediaPluginService> service(
GeckoMediaPluginService::GetGeckoMediaPluginService());
#ifdef DEBUG

Some files were not shown because too many files have changed in this diff Show More