Commit f1241db6 authored by Robert Strong's avatar Robert Strong
Browse files

Bug 862173 - don't verify mar file hash when using mar signing to verify the...

Bug 862173 - don't verify mar file hash when using mar signing to verify the mar file (lessens main thread I/O). r=spohl
parent 72a0b6f8
......@@ -143,6 +143,13 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_VERIFY_MAR_SIGNATURE:
#ifdef MOZ_VERIFY_MAR_SIGNATURE
true,
#else
false,
#endif
MOZ_MAINTENANCE_SERVICE:
#ifdef MOZ_MAINTENANCE_SERVICE
true,
......
......@@ -3872,6 +3872,13 @@ Downloader.prototype = {
}
LOG("Downloader:_verifyDownload downloaded size == expected size.");
// The hash check is not necessary when mar signatures are used to verify
// the downloaded mar file.
if (AppConstants.MOZ_VERIFY_MAR_SIGNATURE) {
return true;
}
let fileStream = Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
fileStream.init(destination, FileUtils.MODE_RDONLY, FileUtils.PERMS_FILE, 0);
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, basic, download, and errors (partial patch with an invalid hash)"
<window title="Update Wizard pages: update check, basic, download, and errors (partial patch with an invalid size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -35,7 +35,7 @@ function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&partialPatchOnly=1" +
"&invalidPartialHash=1" + getVersionParams();
"&invalidPartialSize=1" + getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, basic, download, and errors (complete patch with an invalid hash)"
<window title="Update Wizard pages: update check, basic, download, and errors (complete patch with an invalid size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -35,7 +35,7 @@ function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&completePatchOnly=1" +
"&invalidCompleteHash=1" + getVersionParams();
"&invalidCompleteSize=1" + getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, basic, download, and errors (partial and complete patches with invalid hashes)"
<window title="Update Wizard pages: update check, basic, download, and errors (partial and complete patches with invalid sizes)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -34,8 +34,8 @@ const TESTS = [ {
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialHash=1" +
"&invalidCompleteHash=1" + getVersionParams();
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialSize=1" +
"&invalidCompleteSize=1" + getVersionParams();
setUpdateURLOverride(url);
gUP.checkForUpdates();
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: update check, basic, download, and finished (partial patch with an invalid hash and successful complete patch)"
<window title="Update Wizard pages: update check, basic, download, and finished (partial patch with an invalid size and successful complete patch)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -34,7 +34,7 @@ const TESTS = [ {
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialHash=1" +
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialSize=1" +
getVersionParams();
setUpdateURLOverride(url);
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: errors (partial patch with an invalid hash)"
<window title="Update Wizard pages: errors (partial patch with an invalid size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -27,7 +27,7 @@ const TESTS = [ {
function runTest() {
debugDump("entering");
let patches = getLocalPatchString("partial", null, null, "1234", null, null,
let patches = getLocalPatchString("partial", null, null, null, "1234", null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: errors (complete patch with an invalid hash)"
<window title="Update Wizard pages: errors (complete patch with an invalid size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -27,7 +27,7 @@ const TESTS = [ {
function runTest() {
debugDump("entering");
let patches = getLocalPatchString("complete", null, null, "1234", null, null,
let patches = getLocalPatchString("complete", null, null, null, "1234", null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: errors (partial and complete patches with invalid hashes)"
<window title="Update Wizard pages: errors (partial and complete patches with invalid sizes)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -27,9 +27,9 @@ const TESTS = [ {
function runTest() {
debugDump("entering");
let patches = getLocalPatchString("partial", null, null, "1234", null, null,
let patches = getLocalPatchString("partial", null, null, null, "1234", null,
STATE_DOWNLOADING) +
getLocalPatchString("complete", null, null, "1234", null,
getLocalPatchString("complete", null, null, null, "1234",
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
......
......@@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: finishedBackground (partial patch with an invalid hash and successful complete patch)"
<window title="Update Wizard pages: finishedBackground (partial patch with an invalid size and successful complete patch)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
......@@ -27,7 +27,7 @@ const TESTS = [ {
function runTest() {
debugDump("entering");
let patches = getLocalPatchString("partial", null, null, "1234", null, null,
let patches = getLocalPatchString("partial", null, null, null, "1234", null,
STATE_DOWNLOADING) +
getLocalPatchString("complete", null, null, null, null,
"false");
......
......@@ -42,7 +42,7 @@ function runTest() {
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL, "MD5",
"1234cd43a1c77e30191c53a329a3f99d", null,
null, "1234",
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
......
......@@ -112,18 +112,18 @@ function handleRequest(aRequest, aResponse) {
return;
}
let hash;
let size;
let patches = "";
if (!params.partialPatchOnly) {
hash = SHA512_HASH_SIMPLE_MAR + (params.invalidCompleteHash ? "e" : "");
size = SIZE_SIMPLE_MAR + (params.invalidCompleteSize ? "1" : "");
patches += getRemotePatchString("complete", SERVICE_URL, "SHA512",
hash, SIZE_SIMPLE_MAR);
SHA512_HASH_SIMPLE_MAR, size);
}
if (!params.completePatchOnly) {
hash = SHA512_HASH_SIMPLE_MAR + (params.invalidPartialHash ? "e" : "");
size = SIZE_SIMPLE_MAR + (params.invalidPartialSize ? "1" : "");
patches += getRemotePatchString("partial", SERVICE_URL, "SHA512",
hash, SIZE_SIMPLE_MAR);
SHA512_HASH_SIMPLE_MAR, size);
}
let type = params.type ? params.type : "major";
......
......@@ -23,7 +23,13 @@ function run_test() {
// The mock XMLHttpRequest is MUCH faster
overrideXHR(callHandleEvent);
standardInit();
do_execute_soon(run_test_pt1);
// Only perform the non hash check tests when mar signing is enabled since the
// update service doesn't perform hash checks when mar signing is enabled.
if (IS_MAR_CHECKS_ENABLED) {
do_execute_soon(run_test_pt11);
} else {
do_execute_soon(run_test_pt1);
}
}
// The HttpServer must be stopped before calling do_test_finished
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment