mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1320404 - Remove appId from origin attributes - part 2 - NO_APP_ID UNKNOWN_APP_ID, r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D29354 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
f8565bf748
commit
d179c5015e
@ -246,9 +246,6 @@ interface nsIScriptSecurityManager : nsISupports
|
||||
*/
|
||||
nsIPrincipal getChannelURIPrincipal(in nsIChannel aChannel);
|
||||
|
||||
const unsigned long NO_APP_ID = 0;
|
||||
const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX
|
||||
|
||||
const unsigned long DEFAULT_USER_CONTEXT_ID = 0;
|
||||
|
||||
/**
|
||||
|
@ -103,20 +103,6 @@ function run_test() {
|
||||
checkOriginAttributes(exampleOrg_firstPartyDomain, { firstPartyDomain: "example.org" }, "^firstPartyDomain=example.org");
|
||||
Assert.equal(exampleOrg_firstPartyDomain.origin, "http://example.org^firstPartyDomain=example.org");
|
||||
|
||||
// Make sure we don't crash when serializing principals with UNKNOWN_APP_ID.
|
||||
try {
|
||||
let binaryStream = Cc["@mozilla.org/binaryoutputstream;1"].
|
||||
createInstance(Ci.nsIObjectOutputStream);
|
||||
let pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
|
||||
pipe.init(false, false, 0, 0xffffffff, null);
|
||||
binaryStream.setOutputStream(pipe.outputStream);
|
||||
binaryStream.writeCompoundObject(simplePrin, Ci.nsISupports, true); // eslint-disable-line no-undef
|
||||
binaryStream.close();
|
||||
} catch (e) {
|
||||
Assert.ok(true);
|
||||
}
|
||||
|
||||
|
||||
// Just userContext.
|
||||
var exampleOrg_userContext = ssm.createCodebasePrincipal(makeURI("http://example.org"), {userContextId: 42});
|
||||
checkOriginAttributes(exampleOrg_userContext, { userContextId: 42 }, "^userContextId=42");
|
||||
|
@ -20,8 +20,7 @@ namespace dom {
|
||||
//
|
||||
// If isMozBrowserElement is false, this PopupIPCTabContext is either a
|
||||
// <xul:browser> or an app frame. The frame's app-id and app-frame-owner-app-id
|
||||
// will be equal to the opener's values. For a <xul:browser>, those app IDs
|
||||
// will be NO_APP_ID.
|
||||
// will be equal to the opener's values.
|
||||
//
|
||||
// It's an error to set isMozBrowserElement == false if opener is a mozbrowser
|
||||
// element. Such a PopupIPCTabContext should be rejected by code which receives
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#define NO_APP_ID (nsIScriptSecurityManager::NO_APP_ID)
|
||||
|
||||
using namespace mozilla::dom::ipc;
|
||||
using namespace mozilla::layout;
|
||||
|
||||
|
@ -2034,7 +2034,7 @@ void GetJarPrefix(bool aInIsolatedMozBrowser, nsACString& aJarPrefix) {
|
||||
// AppId is an unused b2g identifier. Let's set it to 0 all the time (see bug
|
||||
// 1320404).
|
||||
// aJarPrefix = appId + "+" + { 't', 'f' } + "+";
|
||||
aJarPrefix.AppendInt(nsIScriptSecurityManager::NO_APP_ID);
|
||||
aJarPrefix.AppendInt(0); // TODO: this is the appId, to be removed.
|
||||
aJarPrefix.Append('+');
|
||||
aJarPrefix.Append(aInIsolatedMozBrowser ? 't' : 'f');
|
||||
aJarPrefix.Append('+');
|
||||
|
@ -119,7 +119,7 @@ nsCString Scheme0Scope(const nsACString& aOriginSuffix,
|
||||
}
|
||||
|
||||
if (oa.mInIsolatedMozBrowser) {
|
||||
result.AppendInt(nsIScriptSecurityManager::NO_APP_ID);
|
||||
result.AppendInt(0); // This is the appId to be removed.
|
||||
result.Append(':');
|
||||
result.Append(oa.mInIsolatedMozBrowser ? 't' : 'f');
|
||||
result.Append(':');
|
||||
|
@ -24,7 +24,7 @@ ContentPermissionPrompt.prototype = {
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionPrompt]),
|
||||
|
||||
handleExistingPermission: function handleExistingPermission(request, type, isApp, callback) {
|
||||
handleExistingPermission: function handleExistingPermission(request, type, callback) {
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, type);
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
callback(/* allow */ true);
|
||||
@ -36,11 +36,6 @@ ContentPermissionPrompt.prototype = {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isApp && result == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
|
||||
callback(/* allow */ false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
@ -59,8 +54,6 @@ ContentPermissionPrompt.prototype = {
|
||||
},
|
||||
|
||||
prompt: function(request) {
|
||||
let isApp = request.principal.appId !== Ci.nsIScriptSecurityManager.NO_APP_ID && request.principal.appId !== Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID;
|
||||
|
||||
// Only allow exactly one permission rquest here.
|
||||
let types = request.types.QueryInterface(Ci.nsIArray);
|
||||
if (types.length != 1) {
|
||||
@ -86,7 +79,7 @@ ContentPermissionPrompt.prototype = {
|
||||
};
|
||||
|
||||
// Returns true if the request was handled
|
||||
if (this.handleExistingPermission(request, perm.type, isApp, callback)) {
|
||||
if (this.handleExistingPermission(request, perm.type, callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -116,9 +109,6 @@ ContentPermissionPrompt.prototype = {
|
||||
// If the user checked "Don't ask again" or this is a desktopNotification, make a permanent exception
|
||||
if (aChecked || entityName == "desktopNotification2") {
|
||||
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
} else if (isApp) {
|
||||
// Otherwise allow the permission for the current session if the request comes from an app
|
||||
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION);
|
||||
}
|
||||
|
||||
callback(/* allow */ true);
|
||||
|
@ -23,9 +23,6 @@ interface nsIDOMWindow;
|
||||
[scriptable, builtinclass, uuid(555e2f8a-a1f6-41dd-88ca-ed4ed6b98a22)]
|
||||
interface nsILoadContextInfo : nsISupports
|
||||
{
|
||||
const unsigned long NO_APP_ID = 0;
|
||||
const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX
|
||||
|
||||
/**
|
||||
* Whether the context is in a Private Browsing mode
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user