mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 546593 - If both a partial and complete update have a verification failure this._update is null, the UI breaks, and the user is not notified of the update failure. r=dtownsend, a=approval2.0 dtownsend
This commit is contained in:
parent
51c54e98b0
commit
0b5a2dd93d
@ -1540,7 +1540,7 @@ var gDownloadingPage = {
|
||||
switch (status) {
|
||||
case CoR.NS_ERROR_UNEXPECTED:
|
||||
if (u.selectedPatch.state == STATE_DOWNLOAD_FAILED &&
|
||||
u.isCompleteUpdate) {
|
||||
(u.isCompleteUpdate || u.patchCount != 2)) {
|
||||
// Verification error of complete patch, informational text is held in
|
||||
// the update object.
|
||||
this.removeDownloadListener();
|
||||
|
@ -2608,7 +2608,7 @@ Downloader.prototype = {
|
||||
var message = getStatusTextFromCode(vfCode, vfCode);
|
||||
this._update.statusText = message;
|
||||
|
||||
if (this._update.isCompleteUpdate)
|
||||
if (this._update.isCompleteUpdate || this._update.patchCount != 2)
|
||||
deleteActiveUpdate = true;
|
||||
|
||||
// Destroy the updates directory, since we're done with it.
|
||||
@ -2654,13 +2654,11 @@ Downloader.prototype = {
|
||||
this._request = null;
|
||||
|
||||
if (state == STATE_DOWNLOAD_FAILED) {
|
||||
if (!this._update.isCompleteUpdate) {
|
||||
var allFailed = true;
|
||||
|
||||
// If we were downloading a patch and the patch verification phase
|
||||
// failed, log this and then commence downloading the complete update.
|
||||
var allFailed = true;
|
||||
// Check if there is a complete update patch that can be downloaded.
|
||||
if (!this._update.isCompleteUpdate && this._update.patchCount == 2) {
|
||||
LOG("Downloader:onStopRequest - verification of patch failed, " +
|
||||
"downloading complete update");
|
||||
"downloading complete update patch");
|
||||
this._update.isCompleteUpdate = true;
|
||||
var status = this.downloadUpdate(this._update);
|
||||
|
||||
@ -2669,38 +2667,32 @@ Downloader.prototype = {
|
||||
} else {
|
||||
allFailed = false;
|
||||
}
|
||||
// This will reset the |.state| property on this._update if a new
|
||||
// download initiates.
|
||||
}
|
||||
|
||||
// if we still fail after trying a complete download, give up completely
|
||||
if (allFailed) {
|
||||
// In all other failure cases, i.e. we're S.O.L. - no more failing over
|
||||
// ...
|
||||
LOG("Downloader:onStopRequest - all update patch downloads failed");
|
||||
// If the update UI is not open (e.g. the user closed the window while
|
||||
// downloading) and if at any point this was a foreground download
|
||||
// notify the user about the error. If the update was a background
|
||||
// update there is no notification since the user won't be expecting it.
|
||||
if (!Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME)) {
|
||||
try {
|
||||
this._update.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
var fgdl = this._update.getProperty("foregroundDownload");
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
// If this was ever a foreground download, and now there is no UI active
|
||||
// (e.g. because the user closed the download window) and there was an
|
||||
// error, we must notify now. Otherwise we can keep the failure to
|
||||
// ourselves since the user won't be expecting it.
|
||||
try {
|
||||
this._update.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
var fgdl = this._update.getProperty("foregroundDownload");
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
if (fgdl == "true") {
|
||||
var prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||
createInstance(Ci.nsIUpdatePrompt);
|
||||
this._update.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
this._update.setProperty("downloadFailed", "true");
|
||||
prompter.showUpdateError(this._update);
|
||||
if (fgdl == "true") {
|
||||
var prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||
createInstance(Ci.nsIUpdatePrompt);
|
||||
prompter.showUpdateError(this._update);
|
||||
}
|
||||
}
|
||||
// Prevent leaking the update object (bug 454964).
|
||||
this._update = null;
|
||||
}
|
||||
|
||||
// Prevent leaking the update object (bug 454964)
|
||||
this._update = null;
|
||||
// the complete download succeeded or total failure was handled, so exit
|
||||
// A complete download has been initiated or the failure was handled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,14 @@ _CHROME_FILES = \
|
||||
test_0052_check_no_updates.xul \
|
||||
test_0053_check_billboard_license_noAttr.xul \
|
||||
test_0054_check_billboard_license_404.xul \
|
||||
test_0061_check_verifyFailPartial_noComplete.xul \
|
||||
test_0062_check_verifyFailComplete_noPartial.xul \
|
||||
test_0063_check_verifyFailPartialComplete.xul \
|
||||
test_0064_check_verifyFailPartial_successComplete.xul \
|
||||
test_0071_notify_verifyFailPartial_noComplete.xul \
|
||||
test_0072_notify_verifyFailComplete_noPartial.xul \
|
||||
test_0073_notify_verifyFailPartialComplete.xul \
|
||||
test_0074_notify_verifyFailPartial_successComplete.xul \
|
||||
test_0081_error_patchApplyFailure_partial_only.xul \
|
||||
test_0082_error_patchApplyFailure_complete_only.xul \
|
||||
test_0083_error_patchApplyFailure_partial_complete.xul \
|
||||
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_CHECKING
|
||||
}, {
|
||||
pageid: PAGEID_FOUND_BASIC,
|
||||
buttonClick: "next"
|
||||
}, {
|
||||
pageid: PAGEID_DOWNLOADING
|
||||
}, {
|
||||
pageid: PAGEID_ERRORS,
|
||||
buttonClick: "finish"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let url = URL_UPDATE + "?showDetails=1&partialPatchOnly=1&invalidPartialHash=1" +
|
||||
getVersionParams();
|
||||
setUpdateURLOverride(url);
|
||||
debugDump("Update URL: " + url);
|
||||
|
||||
gUP.checkForUpdates();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_CHECKING
|
||||
}, {
|
||||
pageid: PAGEID_FOUND_BASIC,
|
||||
buttonClick: "next"
|
||||
}, {
|
||||
pageid: PAGEID_DOWNLOADING
|
||||
}, {
|
||||
pageid: PAGEID_ERRORS,
|
||||
buttonClick: "finish"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let url = URL_UPDATE + "?showDetails=1&completePatchOnly=1&invalidCompleteHash=1" +
|
||||
getVersionParams();
|
||||
setUpdateURLOverride(url);
|
||||
debugDump("Update URL: " + url);
|
||||
|
||||
gUP.checkForUpdates();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_CHECKING
|
||||
}, {
|
||||
pageid: PAGEID_FOUND_BASIC,
|
||||
buttonClick: "next"
|
||||
}, {
|
||||
pageid: PAGEID_DOWNLOADING
|
||||
}, {
|
||||
pageid: PAGEID_ERRORS,
|
||||
buttonClick: "finish"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let url = URL_UPDATE + "?showDetails=1&invalidPartialHash=1&invalidCompleteHash=1" +
|
||||
getVersionParams();
|
||||
setUpdateURLOverride(url);
|
||||
debugDump("Update URL: " + url);
|
||||
|
||||
gUP.checkForUpdates();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_CHECKING
|
||||
}, {
|
||||
pageid: PAGEID_FOUND_BASIC,
|
||||
buttonClick: "next"
|
||||
}, {
|
||||
pageid: PAGEID_DOWNLOADING
|
||||
}, {
|
||||
pageid: PAGEID_FINISHED,
|
||||
buttonClick: "extra1"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let url = URL_UPDATE + "?showDetails=1&invalidPartialHash=1" +
|
||||
getVersionParams();
|
||||
setUpdateURLOverride(url);
|
||||
debugDump("Update URL: " + url);
|
||||
|
||||
gUP.checkForUpdates();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_ERRORS,
|
||||
buttonClick: "finish"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let patches = getLocalPatchString("partial", null, null, "1234", null, null,
|
||||
STATE_DOWNLOADING);
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion);
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||
writeStatusFile(STATE_DOWNLOADING);
|
||||
reloadUpdateManagerData();
|
||||
|
||||
initUpdateServiceStub();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_ERRORS,
|
||||
buttonClick: "finish"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let patches = getLocalPatchString("complete", null, null, "1234", null, null,
|
||||
STATE_DOWNLOADING);
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion);
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||
writeStatusFile(STATE_DOWNLOADING);
|
||||
reloadUpdateManagerData();
|
||||
|
||||
initUpdateServiceStub();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_ERRORS,
|
||||
buttonClick: "finish"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let patches = getLocalPatchString("partial", null, null, "1234", null, null,
|
||||
STATE_DOWNLOADING) +
|
||||
getLocalPatchString("complete", null, null, "1234", null,
|
||||
"false");
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion, null,
|
||||
null, null, null, null, null, null,
|
||||
"false");
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||
writeStatusFile(STATE_DOWNLOADING);
|
||||
reloadUpdateManagerData();
|
||||
|
||||
initUpdateServiceStub();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
-->
|
||||
|
||||
<?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)"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="runTestDefault();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="utils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
const TESTS = [ {
|
||||
pageid: PAGEID_FINISHED_BKGRD,
|
||||
buttonClick: "extra1"
|
||||
} ];
|
||||
|
||||
function runTest() {
|
||||
debugDump("Entering runTest");
|
||||
|
||||
let patches = getLocalPatchString("partial", null, null, "1234", null, null,
|
||||
STATE_DOWNLOADING) +
|
||||
getLocalPatchString("complete", null, null, null, null,
|
||||
"false");
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion, null,
|
||||
null, null, null, null, null, null,
|
||||
"false");
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
|
||||
writeStatusFile(STATE_DOWNLOADING);
|
||||
reloadUpdateManagerData();
|
||||
|
||||
initUpdateServiceStub();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</window>
|
@ -33,7 +33,9 @@ function runTest() {
|
||||
STATE_PENDING);
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion);
|
||||
Services.appinfo.platformVersion, null,
|
||||
null, null, null, null, null, null,
|
||||
"false");
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
|
@ -39,10 +39,13 @@ function runTest() {
|
||||
let slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
|
||||
let patches = getLocalPatchString("partial", null, null, null, null, null,
|
||||
STATE_PENDING) +
|
||||
getLocalPatchString("complete", slowDownloadURL);
|
||||
getLocalPatchString("complete", slowDownloadURL, null, null,
|
||||
null, "false");
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion);
|
||||
Services.appinfo.platformVersion, null,
|
||||
null, null, null, null, null, null,
|
||||
"false");
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
|
@ -40,10 +40,13 @@ function runTest() {
|
||||
let patches = getLocalPatchString("partial", null, null, null, null, null,
|
||||
STATE_PENDING) +
|
||||
getLocalPatchString("complete", slowDownloadURL, "MD5",
|
||||
"1234cd43a1c77e30191c53a329a3f99d");
|
||||
"1234cd43a1c77e30191c53a329a3f99d", null,
|
||||
"false");
|
||||
let updates = getLocalUpdateString(patches, null, null, null,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.platformVersion);
|
||||
Services.appinfo.platformVersion, null,
|
||||
null, null, null, null, null, null,
|
||||
"false");
|
||||
|
||||
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
|
||||
|
||||
|
@ -74,12 +74,20 @@ function handleRequest(aRequest, aResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
var patches = getRemotePatchString("complete", SERVICE_URL, "SHA512",
|
||||
SHA512_HASH, "775");
|
||||
var hash;
|
||||
var patches = "";
|
||||
if (!params.partialPatchOnly) {
|
||||
hash = SHA512_HASH + (params.invalidCompleteHash ? "e" : "");
|
||||
patches += getRemotePatchString("complete", SERVICE_URL, "SHA512",
|
||||
hash, "775");
|
||||
}
|
||||
|
||||
if (!params.completePatchOnly)
|
||||
if (!params.completePatchOnly) {
|
||||
hash = SHA512_HASH + (params.invalidPartialHash ? "e" : "");
|
||||
patches += getRemotePatchString("partial", SERVICE_URL, "SHA512",
|
||||
SHA512_HASH, "775");
|
||||
hash, "775");
|
||||
}
|
||||
|
||||
var type = params.type ? params.type : "major";
|
||||
var name = params.name ? params.name : "App Update Test";
|
||||
var appVersion = params.appVersion ? params.appVersion : "99.9";
|
||||
|
@ -155,7 +155,7 @@ const TEST_ADDONS = [ "appdisabled_1", "appdisabled_2",
|
||||
"updateversion_1", "updateversion_2",
|
||||
"userdisabled_1", "userdisabled_2" ];
|
||||
|
||||
const DEBUG_DUMP = false;
|
||||
const DEBUG = false;
|
||||
|
||||
const TEST_TIMEOUT = 30000; // 30 seconds
|
||||
var gTimeoutTimer;
|
||||
@ -177,7 +177,7 @@ var gDisableNoUpdateAddon = false;
|
||||
#include ../shared.js
|
||||
|
||||
function debugDump(msg) {
|
||||
if (DEBUG_DUMP) {
|
||||
if (DEBUG) {
|
||||
dump("*** " + msg + "\n");
|
||||
}
|
||||
}
|
||||
@ -710,8 +710,9 @@ function setupPrefs() {
|
||||
gAppUpdateChannel = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_CHANNEL);
|
||||
setUpdateChannel();
|
||||
|
||||
// Uncomment for debugging
|
||||
// Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true)
|
||||
if (DEBUG) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true)
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
|
||||
gAppUpdateURL = Services.prefs.setIntPref(PREF_APP_UPDATE_URL_OVERRIDE);
|
||||
@ -731,6 +732,7 @@ function setupPrefs() {
|
||||
debugDump("extensions.update.url: " + extUpdateUrl);
|
||||
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
|
||||
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -770,6 +772,10 @@ function resetPrefs() {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_IDLETIME);
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_PROMPTWAITTIME)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_PROMPTWAITTIME);
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_DETAILS)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_DETAILS);
|
||||
}
|
||||
@ -1142,46 +1148,38 @@ var certErrorsPrefObserver = {
|
||||
* nsIObserver for receiving window open and close notifications.
|
||||
*/
|
||||
var gWindowObserver = {
|
||||
loaded: false,
|
||||
|
||||
observe: function WO_observe(aSubject, aTopic, aData) {
|
||||
let win = aSubject.QueryInterface(AUS_Ci.nsIDOMEventTarget);
|
||||
|
||||
if (aTopic == "domwindowclosed") {
|
||||
if (win.location == URI_UPDATE_PROMPT_DIALOG) {
|
||||
// Allow tests the ability to provide their own function (it must be
|
||||
// named finishTest) for finishing the test.
|
||||
try {
|
||||
finishTest();
|
||||
}
|
||||
catch (e) {
|
||||
finishTestDefault();
|
||||
}
|
||||
if (win.location != URI_UPDATE_PROMPT_DIALOG) {
|
||||
debugDump("gWindowObserver:observe - domwindowclosed event for " +
|
||||
"window not being tested - location: " + win.location +
|
||||
"... returning early");
|
||||
return;
|
||||
}
|
||||
// Allow tests the ability to provide their own function (it must be
|
||||
// named finishTest) for finishing the test.
|
||||
try {
|
||||
finishTest();
|
||||
}
|
||||
catch (e) {
|
||||
finishTestDefault();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Defensive measure to prevent adding multiple listeners.
|
||||
if (this.loaded) {
|
||||
// This should never happen but if it does this will provide a clue for
|
||||
// diagnosing the cause.
|
||||
ok(false, "Unexpected gWindowObserver:observe - called with aTopic = " +
|
||||
aTopic + "... returning early");
|
||||
return;
|
||||
}
|
||||
|
||||
win.addEventListener("load", function onLoad() {
|
||||
// Defensive measure to prevent windows we shouldn't see from breaking
|
||||
// a test.
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
// Ignore windows other than the update UI window.
|
||||
if (win.location != URI_UPDATE_PROMPT_DIALOG) {
|
||||
// This should never happen.
|
||||
ok(false, "Unexpected load event - win.location got: " + location +
|
||||
", expected: " + URI_UPDATE_PROMPT_DIALOG + "... returning early");
|
||||
debugDump("gWindowObserver:observe:onLoad - load event for window " +
|
||||
"not being tested - location: " + win.location +
|
||||
"... returning early");
|
||||
return;
|
||||
}
|
||||
|
||||
// Defensive measure to prevent an unexpected wizard page from breaking
|
||||
// a test.
|
||||
// The first wizard page should always be the dummy page.
|
||||
let pageid = win.document.documentElement.currentPage.pageid;
|
||||
if (pageid != PAGEID_DUMMY) {
|
||||
// This should never happen but if it does this will provide a clue
|
||||
@ -1191,7 +1189,6 @@ var gWindowObserver = {
|
||||
return;
|
||||
}
|
||||
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
gTimeoutTimer = AUS_Cc["@mozilla.org/timer;1"].
|
||||
createInstance(AUS_Ci.nsITimer);
|
||||
gTimeoutTimer.initWithCallback(finishTestTimeout, TEST_TIMEOUT,
|
||||
@ -1201,7 +1198,5 @@ var gWindowObserver = {
|
||||
gDocElem = gWin.document.documentElement;
|
||||
gDocElem.addEventListener("pageshow", onPageShowDefault, false);
|
||||
}, false);
|
||||
|
||||
this.loaded = true;
|
||||
}
|
||||
};
|
||||
|
@ -54,6 +54,7 @@ const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
|
||||
const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
|
||||
const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI";
|
||||
const PREF_APP_UPDATE_URL = "app.update.url";
|
||||
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
|
||||
|
Loading…
Reference in New Issue
Block a user