import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"extends": [
"../../../../../testing/mochitest/chrome.eslintrc.js"
]
};

View file

@ -0,0 +1,64 @@
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
[DEFAULT]
tags = appupdate
support-files =
utils.js
update.sjs
; mochitest-chrome tests must start with "test_" and are executed in sorted
; order and not in the order specified in the manifest.
[test_0010_background_basic.xul]
[test_0011_check_basic.xul]
[test_0012_check_basic_staging.xul]
skip-if = asan
reason = Bug 1168003
[test_0013_check_no_updates.xul]
[test_0014_check_error_xml_malformed.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]
[test_0084_error_patchApplyFailure_verify_failed.xul]
[test_0085_error_patchApplyFailure_partial_complete_staging.xul]
skip-if = asan
reason = Bug 1168003
[test_0092_finishedBackground.xul]
[test_0093_restartNotification.xul]
[test_0094_restartNotification_remote.xul]
[test_0095_restartNotification_remoteInvalidNumber.xul]
[test_0096_restartNotification_stagedBackground.xul]
skip-if = asan
reason = Bug 1168003
[test_0097_restartNotification_stagedServiceBackground.xul]
skip-if = os != 'win'
reason = only Windows has the maintenance service.
[test_0101_background_restartNotification.xul]
[test_0102_background_restartNotification_staging.xul]
skip-if = asan
reason = Bug 1168003
[test_0103_background_restartNotification_stagingService.xul]
skip-if = os != 'win'
reason = only Windows has the maintenance service.
[test_0111_neverButton_basic.xul]
[test_0113_showNeverForVersionRemovedWithPref.xul]
[test_0151_notify_backgroundCheckError.xul]
[test_0152_notify_backgroundCheckOfflineRetry.xul]
[test_0161_check_unsupported.xul]
[test_0162_notify_unsupported.xul]
[test_0171_check_noPerms_manual.xul]
skip-if = os != 'win'
reason = test must be able to prevent file deletion.
[test_0172_notify_noPerms_manual.xul]
skip-if = os != 'win'
reason = test must be able to prevent file deletion.
[test_9999_cleanup.xul]

View file

@ -0,0 +1,50 @@
<?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: basic, download, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_FOUND_BASIC,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURL(url);
gAUS.checkForBackgroundUpdates();
}
]]>
</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>

View file

@ -0,0 +1,51 @@
<?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"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(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>

View file

@ -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 with staging, and finished"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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"
} ];
gUseTestUpdater = true;
function runTest() {
debugDump("entering");
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(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>

View file

@ -0,0 +1,46 @@
<?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 and no updates found"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_NO_UPDATES_FOUND,
buttonClick: "finish"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?noUpdates=1";
setUpdateURL(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>

View file

@ -0,0 +1,46 @@
<?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 and error (xml malformed)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_ERRORS,
buttonClick: "finish"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?xmlMalformed=1";
setUpdateURL(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>

View file

@ -0,0 +1,52 @@
<?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 size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&partialPatchOnly=1" +
"&invalidPartialSize=1" + getVersionParams();
setUpdateURL(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>

View file

@ -0,0 +1,52 @@
<?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 size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&completePatchOnly=1" +
"&invalidCompleteSize=1" + getVersionParams();
setUpdateURL(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>

View file

@ -0,0 +1,52 @@
<?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 sizes)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialSize=1" +
"&invalidCompleteSize=1" + getVersionParams();
setUpdateURL(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>

View file

@ -0,0 +1,52 @@
<?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 size 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/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");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialSize=1" +
getVersionParams();
setUpdateURL(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>

View file

@ -0,0 +1,53 @@
<?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 size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("partial", null, null, null, "1234", 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();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -0,0 +1,52 @@
<?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 size)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("complete", null, null, null, "1234", null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_DOWNLOADING);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -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 and complete patches with invalid sizes)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("partial", null, null, null, "1234", null,
STATE_DOWNLOADING) +
getLocalPatchString("complete", null, null, null, "1234",
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_DOWNLOADING);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -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: 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"
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");
let patches = getLocalPatchString("partial", null, null, null, "1234", null,
STATE_DOWNLOADING) +
getLocalPatchString("complete", null, null, null, null,
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_DOWNLOADING);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -0,0 +1,53 @@
<?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 only patch apply failure)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED_CRC_ERROR);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -0,0 +1,52 @@
<?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 only patch apply failure)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED_CRC_ERROR);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -0,0 +1,67 @@
<?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: error patching, download, and finished (partial failed and download complete)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_ERROR_PATCHING,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING,
extraStartFunction: createContinueFile
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1",
extraStartFunction: removeContinueFile
} ];
function runTest() {
debugDump("entering");
removeContinueFile();
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
let slowDownloadURL = URL_HTTP_UPDATE_XML + "?slowDownloadMar=1";
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL, null, null,
null, "false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED_CRC_ERROR);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -0,0 +1,68 @@
<?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: error patching, download, and errors (partial failed and download complete verification failure)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_ERROR_PATCHING,
buttonClick: "next"
}, {
pageid: PAGEID_DOWNLOADING,
extraStartFunction: createContinueFile
}, {
pageid: PAGEID_ERRORS,
buttonClick: "finish",
extraStartFunction: removeContinueFile
} ];
function runTest() {
debugDump("entering");
removeContinueFile();
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
let slowDownloadURL = URL_HTTP_UPDATE_XML + "?slowDownloadMar=1";
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL, "MD5",
null, "1234",
"false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED_CRC_ERROR);
reloadUpdateManagerData();
testPostUpdateProcessing();
}
]]>
</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>

View file

@ -0,0 +1,94 @@
<?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: error patching, download with staging, and finished (partial failed and download complete), with fast MAR download"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
// This test forces the download to complete before the "next" button on the
// errorpatching wizard page is clicked. This is done by creating the continue
// file when the wizard loads to start the download, then clicking the "next"
// button in the download's onStopRequest event listener.
const testDownloadListener = {
onStartRequest(aRequest, aContext) { },
onProgress(aRequest, aContext, aProgress, aMaxProgress) { },
onStatus(aRequest, aContext, aStatus, aStatusText) { },
onStopRequest(aRequest, aContext, aStatus) {
debugDump("clicking errorpatching page next button");
gDocElem.getButton("next").click();
gAUS.removeDownloadListener(this);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
Ci.nsIProgressEventSink])
};
let TESTS = [ {
pageid: PAGEID_ERROR_PATCHING,
extraCheckFunction: createContinueFile
}, {
pageid: PAGEID_DOWNLOADING
}, {
pageid: PAGEID_FINISHED,
buttonClick: "extra1",
extraStartFunction: removeContinueFile
} ];
gUseTestUpdater = true;
function runTest() {
debugDump("entering");
removeContinueFile();
// Specify the url to update.sjs with a slowDownloadMar param so the ui can
// load before the download completes.
let slowDownloadURL = URL_HTTP_UPDATE_XML + "?slowDownloadMar=1";
let patches = getLocalPatchString("partial", null, null, null, null, null,
STATE_PENDING) +
getLocalPatchString("complete", slowDownloadURL, null, null,
null, "false");
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, "false");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_FAILED_READ_ERROR);
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
reloadUpdateManagerData();
testPostUpdateProcessing();
gAUS.addDownloadListener(testDownloadListener);
}
]]>
</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>

View file

@ -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: finished background"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, "pending",
"The active update should have a state of pending");
gUP.showUpdateDownloaded(gUpdateManager.activeUpdate);
}
]]>
</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>

View file

@ -0,0 +1,60 @@
<?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: restart notification pref promptWaitTime"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, STATE_PENDING,
"The active update should have a state of " + STATE_PENDING);
ok(gUpdateManager.activeUpdate.promptWaitTime == 1, "Checking that the " +
"update's promptWaitTime attribute value was set from the " +
PREF_APP_UPDATE_PROMPTWAITTIME + " preference");
gUP.showUpdateDownloaded(gUpdateManager.activeUpdate, true);
}
]]>
</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>

View file

@ -0,0 +1,60 @@
<?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: restart notification xml promptWaitTime"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version, null,
null, null, null, null, false,
null, false, false, false, 1);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, STATE_PENDING,
"The active update should have a state of " + STATE_PENDING);
ok(gUpdateManager.activeUpdate.promptWaitTime == 1, "Checking that the " +
"update's promptWaitTime attribute value was set by the XML");
gUP.showUpdateDownloaded(gUpdateManager.activeUpdate, true);
}
]]>
</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>

View file

@ -0,0 +1,66 @@
<?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: restart notification xml promptWaitTime with invalid number"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_PENDING);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
null, null,
null, null, null,
null, false, null,
false, false,
false, "invalidNumber");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_SUCCEEDED);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, STATE_PENDING,
"The active update should have a state of " + STATE_PENDING);
ok(gUpdateManager.activeUpdate.promptWaitTime == 1, "Checking that the " +
"update's promptWaitTime attribute value was set from the " +
PREF_APP_UPDATE_PROMPTWAITTIME + " preference");
gUP.showUpdateDownloaded(gUpdateManager.activeUpdate, true);
}
]]>
</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>

View file

@ -0,0 +1,65 @@
<?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: restart notification staged w/o service"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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"
} ];
gUseTestUpdater = true;
function runTest() {
debugDump("entering");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_APPLIED);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_APPLIED);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, STATE_APPLIED,
"The active update should have a state of " + STATE_APPLIED);
ok(gUpdateManager.activeUpdate.promptWaitTime == 1, "Checking that the " +
"update's promptWaitTime attribute value was set from the " +
PREF_APP_UPDATE_PROMPTWAITTIME + " preference");
gUpdateManager.refreshUpdateStatus();
}
]]>
</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>

View file

@ -0,0 +1,65 @@
<?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: restart notification staged with service"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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"
} ];
gUseTestUpdater = true;
function runTest() {
debugDump("entering");
let patches = getLocalPatchString("complete", null, null, null, null, null,
STATE_APPLIED_SVC);
let updates = getLocalUpdateString(patches, null, null, null,
Services.appinfo.version,
Services.appinfo.platformVersion);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
writeStatusFile(STATE_APPLIED_SVC);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
reloadUpdateManagerData();
is(gUpdateManager.activeUpdate.state, STATE_APPLIED_SVC,
"The active update should have a state of " + STATE_APPLIED_SVC);
ok(gUpdateManager.activeUpdate.promptWaitTime == 1, "Checking that the " +
"update's promptWaitTime attribute value was set from the " +
PREF_APP_UPDATE_PROMPTWAITTIME + " preference");
gUpdateManager.refreshUpdateStatus();
}
]]>
</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>

View file

@ -0,0 +1,46 @@
<?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: background finish with a background download"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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");
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(url);
gAUS.notify(null);
}
]]>
</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>

View file

@ -0,0 +1,49 @@
<?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: background finish with a background download and update staging"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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"
} ];
gUseTestUpdater = true;
function runTest() {
debugDump("entering");
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(url);
gAUS.notify(null);
}
]]>
</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>

View file

@ -0,0 +1,50 @@
<?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: background finish with a background download and update staging and servicefs"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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"
} ];
gUseTestUpdater = true;
function runTest() {
debugDump("entering");
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(url);
gAUS.notify(null);
}
]]>
</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>

View file

@ -0,0 +1,61 @@
<?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 and basic (never button test)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
gPrefToCheck = PREFBRANCH_APP_UPDATE_NEVER + Services.appinfo.version;
const TESTS = [ {
pageid: PAGEID_CHECKING
}, {
pageid: PAGEID_FOUND_BASIC,
extraDelayedCheckFunction: checkPrefHasUserValue,
prefHasUserValue: false,
neverButton: true,
buttonClick: "extra2"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showNever=1&showDetails=1" +
getVersionParams();
setUpdateURL(url);
// add the never preference for this version to verify that checking for
// updates clears the preference.
Services.prefs.setBoolPref(gPrefToCheck, true)
gUP.checkForUpdates();
}
function finishTest() {
checkPrefHasUserValue(true);
finishTestDefault();
}
]]>
</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>

View file

@ -0,0 +1,58 @@
<?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 available with never pref and without showNeverForVersion"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
gPrefToCheck = PREFBRANCH_APP_UPDATE_NEVER + Services.appinfo.version;
const TESTS = [ {
pageid: PAGEID_FOUND_BASIC,
extraDelayedCheckFunction: checkPrefHasUserValue,
prefHasUserValue: true,
buttonClick: "extra1"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURL(url);
// add the never preference for this version to verify that checking for
// updates clears the preference.
Services.prefs.setBoolPref(gPrefToCheck, true)
gAUS.notify(null);
}
function finishTest() {
Services.prefs.clearUserPref(gPrefToCheck)
finishTestDefault();
}
]]>
</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>

View file

@ -0,0 +1,50 @@
<?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="Test notification when multiple background check errors occur (bug 595455)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_ERROR_EXTRA,
extraDelayedCheckFunction: checkErrorExtraPage,
shouldBeHidden: false,
displayedTextElem: "bgErrorLabel",
buttonClick: "finish"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?xmlMalformed=1";
setUpdateURL(url);
errorsPrefObserver.init(PREF_APP_UPDATE_BACKGROUNDERRORS,
PREF_APP_UPDATE_BACKGROUNDMAXERRORS);
gAUS.notify(null);
}
]]>
</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>

View file

@ -0,0 +1,96 @@
<?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="Test that an update check that fails due to being offline is performed after going online"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_FOUND_BASIC,
buttonClick: "extra1"
} ];
const NETWORK_ERROR_OFFLINE = 111;
var gProxyPrefValue;
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(url);
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
Services.io.offline = true;
gProxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
Services.prefs.setIntPref("network.proxy.type", 0);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}
function resetOffline() {
Services.prefs.setIntPref("network.proxy.type", gProxyPrefValue);
Services.io.offline = false;
}
/* Update check listener */
const updateCheckListener = {
onProgress: function UCL_onProgress(aRequest, aPosition, aTotalSize) {
},
onCheckComplete: function UCL_onCheckComplete(aRequest, aUpdates, aUpdateCount) {
let status = aRequest.status;
if (status == 0) {
status = aRequest.channel.QueryInterface(Ci.nsIRequest).status;
}
debugDump("url = " + aRequest.channel.originalURI.spec + ", " +
"request.status = " + status + ", " +
"updateCount = " + aUpdateCount);
ok(false, "Unexpected updateCheckListener::onCheckComplete called");
},
onError: function UCL_onError(aRequest, aUpdate) {
let status = aRequest.status;
if (status == 0) {
status = aRequest.channel.QueryInterface(Ci.nsIRequest).status;
}
is(status, Cr.NS_ERROR_OFFLINE,
"checking the request status value");
is(aUpdate.errorCode, NETWORK_ERROR_OFFLINE,
"checking the update error code");
debugDump("url = " + aRequest.channel.originalURI.spec + ", " +
"request.status = " + status + ", " +
"update.statusText = " +
(aUpdate.statusText ? aUpdate.statusText : "null"));
gAUS.onError(aRequest, aUpdate);
// Use a timeout to allow the XHR to complete
SimpleTest.executeSoon(resetOffline);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateCheckListener])
};
]]>
</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>

View file

@ -0,0 +1,50 @@
<?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="Test checking for updates when system is no longer supported (bug 843497)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_UNSUPPORTED,
buttonClick: "finish"
} ];
function runTest() {
debugDump("entering");
// When checking manually the unsupported page should still be shown even if
// it was shown previously.
Services.prefs.setBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, true);
let url = URL_HTTP_UPDATE_XML + "?unsupported=1";
setUpdateURL(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>

View file

@ -0,0 +1,44 @@
<?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="Test notification of updates when system is no longer supported (bug 843497)"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_UNSUPPORTED,
buttonClick: "finish"
} ];
function runTest() {
debugDump("entering");
let url = URL_HTTP_UPDATE_XML + "?unsupported=1";
setUpdateURL(url);
gAUS.notify(null);
}
]]>
</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>

View file

@ -0,0 +1,64 @@
<?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: manual"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_MANUAL_UPDATE,
buttonClick: "finish",
extraCheckFunction: getWriteTestFile
} ];
function runTest() {
debugDump("entering");
let file = getWriteTestFile();
file.create(file.NORMAL_FILE_TYPE, 0o444);
file.fileAttributesWin |= file.WFA_READONLY;
file.fileAttributesWin &= ~file.WFA_READWRITE;
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
setUpdateURL(url);
gUP.checkForUpdates();
}
function getWriteTestFile() {
let file = getAppBaseDir();
file.append(FILE_UPDATE_TEST);
file.QueryInterface(Ci.nsILocalFileWin);
if (file.exists()) {
file.fileAttributesWin |= file.WFA_READWRITE;
file.fileAttributesWin &= ~file.WFA_READONLY;
file.remove(true);
}
return file;
}
]]>
</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>

View file

@ -0,0 +1,63 @@
<?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: manual"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<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_MANUAL_UPDATE,
buttonClick: "finish",
extraCheckFunction: getWriteTestFile
} ];
function runTest() {
debugDump("entering");
let file = getWriteTestFile();
file.create(file.NORMAL_FILE_TYPE, 0o444);
file.fileAttributesWin |= file.WFA_READONLY;
file.fileAttributesWin &= ~file.WFA_READWRITE;
let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" +
getVersionParams();
setUpdateURL(url);
gAUS.checkForBackgroundUpdates();
}
function getWriteTestFile() {
let file = getAppBaseDir();
file.append(FILE_UPDATE_TEST);
file.QueryInterface(Ci.nsILocalFileWin);
if (file.exists()) {
file.fileAttributesWin |= file.WFA_READWRITE;
file.fileAttributesWin &= ~file.WFA_READONLY;
file.remove(true);
}
return file;
}
]]>
</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>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Removes files and preferences for previous application update tests in case
* any of them had a fatal error. The test name ensures that it will run after
* all other tests as long as the test naming uses the same format as the
* existing tests.
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Application Update test cleanup"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTest();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
/**
* If the application update tests left behind any of the files it uses it could
* be a very bad thing. The purpose of this test is to prevent that from
* happening.
*/
function runTest() {
debugDump("entering");
SimpleTest.waitForExplicitFinish();
if (DEBUG_AUS_TEST) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true);
}
closeUpdateWindow();
// Always leave the app.update.enabled and app.update.staging.enabled
// preferences set to false when cleaning up.
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, false);
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false);
resetFiles();
removeUpdateDirsAndFiles();
reloadUpdateManagerData();
let file = getUpdatesXMLFile(true);
ok(!file.exists(), file.path + " should not exist");
file = getUpdatesXMLFile(false);
ok(!file.exists(), file.path + " should not exist");
let dir = getUpdatesDir();
file = dir.clone();
file.append(FILE_UPDATE_STATUS);
ok(!file.exists(), file.path + " should not exist");
file = dir.clone();
file.append(FILE_UPDATE_MAR);
ok(!file.exists(), file.path + " should not exist");
cleanupRestoreUpdaterBackup();
}
/**
* After all tests finish this will repeatedly attempt to restore the real
* updater if it exists and then call finishTest after the restore is
* successful.
*/
function cleanupRestoreUpdaterBackup() {
debugDump("entering");
try {
// Windows debug builds keep the updater file in use for a short period of
// time after the updater process exits.
restoreUpdaterBackup();
} catch (e) {
logTestInfo("Attempt to restore the backed up updater failed... " +
"will try again, Exception: " + e);
SimpleTest.executeSoon(cleanupRestoreUpdaterBackup);
return;
}
SimpleTest.executeSoon(finishTest);
}
function finishTest() {
debugDump("entering");
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LOG)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_LOG);
}
SimpleTest.finish();
}
]]>
</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>

View file

@ -0,0 +1,194 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Server side http server script for application update tests.
*/
const { classes: Cc, interfaces: Ci } = Components;
const REL_PATH_DATA = "chrome/toolkit/mozapps/update/tests/data/";
function getTestDataFile(aFilename) {
let file = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("CurWorkD", Ci.nsILocalFile);
let pathParts = REL_PATH_DATA.split("/");
for (let i = 0; i < pathParts.length; ++i) {
file.append(pathParts[i]);
}
if (aFilename) {
file.append(aFilename);
}
return file;
}
function loadHelperScript() {
let scriptFile = getTestDataFile("sharedUpdateXML.js");
let io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService2);
let scriptSpec = io.newFileURI(scriptFile).spec;
let scriptloader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
scriptloader.loadSubScript(scriptSpec, this);
}
loadHelperScript();
const URL_HOST = "http://example.com";
const URL_PATH_UPDATE_XML = "/chrome/toolkit/mozapps/update/tests/chrome/update.sjs";
const URL_HTTP_UPDATE_SJS = URL_HOST + URL_PATH_UPDATE_XML;
const SERVICE_URL = URL_HOST + "/" + REL_PATH_DATA + FILE_SIMPLE_MAR;
const SLOW_MAR_DOWNLOAD_INTERVAL = 100;
var gTimer;
function handleRequest(aRequest, aResponse) {
let params = { };
if (aRequest.queryString) {
params = parseQueryString(aRequest.queryString);
}
let statusCode = params.statusCode ? parseInt(params.statusCode) : 200;
let statusReason = params.statusReason ? params.statusReason : "OK";
aResponse.setStatusLine(aRequest.httpVersion, statusCode, statusReason);
aResponse.setHeader("Cache-Control", "no-cache", false);
// When a mar download is started by the update service it can finish
// downloading before the ui has loaded. By specifying a serviceURL for the
// update patch that points to this file and has a slowDownloadMar param the
// mar will be downloaded asynchronously which will allow the ui to load
// before the download completes.
if (params.slowDownloadMar) {
aResponse.processAsync();
aResponse.setHeader("Content-Type", "binary/octet-stream");
aResponse.setHeader("Content-Length", SIZE_SIMPLE_MAR);
var continueFile = getTestDataFile("continue");
var contents = readFileBytes(getTestDataFile(FILE_SIMPLE_MAR));
gTimer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
gTimer.initWithCallback(function(aTimer) {
if (continueFile.exists()) {
gTimer.cancel();
aResponse.write(contents);
aResponse.finish();
}
}, SLOW_MAR_DOWNLOAD_INTERVAL, Ci.nsITimer.TYPE_REPEATING_SLACK);
return;
}
if (params.uiURL) {
let remoteType = "";
if (!params.remoteNoTypeAttr && params.uiURL == "BILLBOARD") {
remoteType = " " + params.uiURL.toLowerCase() + "=\"1\"";
}
aResponse.write("<html><head><meta http-equiv=\"content-type\" content=" +
"\"text/html; charset=utf-8\"></head><body" +
remoteType + ">" + params.uiURL +
"<br><br>this is a test mar that will not affect your " +
"build.</body></html>");
return;
}
if (params.xmlMalformed) {
aResponse.write("xml error");
return;
}
if (params.noUpdates) {
aResponse.write(getRemoteUpdatesXMLString(""));
return;
}
if (params.unsupported) {
aResponse.write(getRemoteUpdatesXMLString(" <update type=\"major\" " +
"unsupported=\"true\" " +
"detailsURL=\"" + URL_HOST +
"\"></update>\n"));
return;
}
let size;
let patches = "";
if (!params.partialPatchOnly) {
size = SIZE_SIMPLE_MAR + (params.invalidCompleteSize ? "1" : "");
patches += getRemotePatchString("complete", SERVICE_URL, "SHA512",
SHA512_HASH_SIMPLE_MAR, size);
}
if (!params.completePatchOnly) {
size = SIZE_SIMPLE_MAR + (params.invalidPartialSize ? "1" : "");
patches += getRemotePatchString("partial", SERVICE_URL, "SHA512",
SHA512_HASH_SIMPLE_MAR, size);
}
let type = params.type ? params.type : "major";
let name = params.name ? params.name : "App Update Test";
let appVersion = params.appVersion ? params.appVersion : "999999.9";
let displayVersion = params.displayVersion ? params.displayVersion
: "version " + appVersion;
let buildID = params.buildID ? params.buildID : "01234567890123";
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// let detailsURL = params.showDetails ? URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS" : null;
let detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS";
let showPrompt = params.showPrompt ? "true" : null;
let showNever = params.showNever ? "true" : null;
let promptWaitTime = params.promptWaitTime ? params.promptWaitTime : null;
let updates = getRemoteUpdateString(patches, type, "App Update Test",
displayVersion, appVersion, buildID,
detailsURL, showPrompt, showNever,
promptWaitTime);
aResponse.write(getRemoteUpdatesXMLString(updates));
}
/**
* Helper function to create a JS object representing the url parameters from
* the request's queryString.
*
* @param aQueryString
* The request's query string.
* @return A JS object representing the url parameters from the request's
* queryString.
*/
function parseQueryString(aQueryString) {
let paramArray = aQueryString.split("&");
let regex = /^([^=]+)=(.*)$/;
let params = {};
for (let i = 0, sz = paramArray.length; i < sz; i++) {
let match = regex.exec(paramArray[i]);
if (!match) {
throw "Bad parameter in queryString! '" + paramArray[i] + "'";
}
params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
}
return params;
}
/**
* Reads the binary contents of a file and returns it as a string.
*
* @param aFile
* The file to read from.
* @return The contents of the file as a string.
*/
function readFileBytes(aFile) {
let fis = Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
fis.init(aFile, -1, -1, false);
let bis = Cc["@mozilla.org/binaryinputstream;1"].
createInstance(Ci.nsIBinaryInputStream);
bis.setInputStream(fis);
let data = [];
let count = fis.available();
while (count > 0) {
let bytes = bis.readByteArray(Math.min(65535, count));
data.push(String.fromCharCode.apply(null, bytes));
count -= bytes.length;
if (bytes.length == 0) {
throw "Nothing read from input stream!";
}
}
data.join('');
fis.close();
return data.toString();
}

File diff suppressed because it is too large Load diff