Bug 1218284 - Match signed packages' with trust origin without suffix. r=valentin

This commit is contained in:
Jonathan Hao 2015-10-26 15:30:38 +08:00
parent d14edeff37
commit 088ac76c5a
2 changed files with 5 additions and 3 deletions

View File

@ -18,6 +18,7 @@
#include "nsIInputStream.h"
#include "nsComponentManagerUtils.h"
#include "nsIURL.h"
#include "mozilla/BasePrincipal.h"
static const short kResourceHashType = nsICryptoHash::SHA256;
@ -74,14 +75,15 @@ NS_IMETHODIMP PackagedAppVerifier::Init(nsIPackagedAppVerifierListener* aListene
mListener = aListener;
mState = STATE_UNKNOWN;
mPackageOrigin = aPackageOrigin;
mSignature = aSignature;
mIsPackageSigned = false;
mPackageCacheEntry = aPackageCacheEntry;
mIsFirstResource = true;
mManifest = EmptyCString();
mBypassVerification = (mPackageOrigin ==
nsAutoCString originNoSuffix;
OriginAttributes().PopulateFromOrigin(aPackageOrigin, originNoSuffix);
mBypassVerification = (originNoSuffix ==
Preferences::GetCString("network.http.signed-packages.trusted-origin"));
nsresult rv;

View File

@ -241,7 +241,7 @@ function test_channel_with_bad_signature_from_trusted_origin() {
let pref = "network.http.signed-packages.trusted-origin";
ok(!!Ci.nsISupportsString, "Ci.nsISupportsString");
let origin = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
origin.data = uri + "^appId=1024";
origin.data = uri;
Services.prefs.setComplexValue(pref, Ci.nsISupportsString, origin);
var channel = make_channel(uri+"/package_with_bad_signature!//index.html");
channel.notificationCallbacks = new LoadContextCallback(1024, false, false, false);