mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1354175 - Disable AppCache in insecure contexts. r=baku,bkelly,mayhemer
MozReview-Commit-ID: wYWHkGlV8h --HG-- extra : rebase_source : 9a600559a9d61c42baf9e3e5fde6e35d5adeaf90
This commit is contained in:
parent
bb16936244
commit
53c9c480b7
@ -6,6 +6,7 @@
|
||||
###############################################################################
|
||||
|
||||
[DEFAULT]
|
||||
prefs = browser.cache.offline.insecure.enable=true
|
||||
support-files =
|
||||
POSTSearchEngine.xml
|
||||
alltabslistener.html
|
||||
@ -52,8 +53,6 @@ support-files =
|
||||
head.js
|
||||
moz.png
|
||||
navigating_window_with_download.html
|
||||
offlineQuotaNotification.cacheManifest
|
||||
offlineQuotaNotification.html
|
||||
page_style_sample.html
|
||||
pinning_headers.sjs
|
||||
ssl_error_reports.sjs
|
||||
@ -366,6 +365,7 @@ subsuite = clipboard
|
||||
[browser_new_http_window_opened_from_file_tab.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_offlineQuotaNotification.js]
|
||||
support-files = offlineQuotaNotification.cacheManifest offlineQuotaNotification.html
|
||||
skip-if = os == "linux" && !debug # bug 1304273
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_feed_discovery.js]
|
||||
|
@ -23,5 +23,3 @@ support-files =
|
||||
|
||||
[test_bug364677.html]
|
||||
[test_bug395533.html]
|
||||
[test_offlineNotification.html]
|
||||
skip-if = e10s # Bug 1257785
|
||||
|
@ -1,121 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
||||
-->
|
||||
<head>
|
||||
<title>Test offline app notification</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="offlineByDefault.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display">
|
||||
<!-- Load the test frame twice from the same domain,
|
||||
to make sure we get notifications for both -->
|
||||
<iframe name="testFrame" src="offlineChild.html"></iframe>
|
||||
<iframe name="testFrame2" src="offlineChild2.html"></iframe>
|
||||
<!-- Load from another domain to make sure we get a second allow/deny
|
||||
notification -->
|
||||
<iframe name="testFrame3" src="http://example.com/tests/browser/base/content/test/general/offlineChild.html"></iframe>
|
||||
|
||||
<iframe id="eventsTestFrame" src="offlineEvent.html"></iframe>
|
||||
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
/* import-globals-from offlineByDefault.js */
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.Cc;
|
||||
|
||||
var numFinished = 0;
|
||||
|
||||
window.addEventListener("message", function(event) {
|
||||
is(event.data, "success", "Child was successfully cached.");
|
||||
|
||||
if (++numFinished == 3) {
|
||||
// Clean up after ourself
|
||||
var uri1 = SpecialPowers.Services.io.newURI(frames.testFrame.location);
|
||||
var uri2 = SpecialPowers.Services.io.newURI(frames.testFrame3.location);
|
||||
|
||||
var principal1 = SpecialPowers.Services.scriptSecurityManager.createCodebasePrincipal(uri1, {});
|
||||
var principal2 = SpecialPowers.Services.scriptSecurityManager.createCodebasePrincipal(uri2, {});
|
||||
|
||||
SpecialPowers.Services.perms.removeFromPrincipal(principal1, "offline-app");
|
||||
SpecialPowers.Services.perms.removeFromPrincipal(principal2, "offline-app");
|
||||
|
||||
offlineByDefault.reset();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
|
||||
var count = 0;
|
||||
var expectedEvent = "";
|
||||
function eventHandler(evt) {
|
||||
++count;
|
||||
is(evt.type, expectedEvent, "Wrong event!");
|
||||
}
|
||||
|
||||
function testEventHandling() {
|
||||
var events = [ "checking",
|
||||
"error",
|
||||
"noupdate",
|
||||
"downloading",
|
||||
"progress",
|
||||
"updateready",
|
||||
"cached",
|
||||
"obsolete"];
|
||||
var w = document.getElementById("eventsTestFrame").contentWindow;
|
||||
var e;
|
||||
for (var i = 0; i < events.length; ++i) {
|
||||
count = 0;
|
||||
expectedEvent = events[i];
|
||||
e = w.document.createEvent("event");
|
||||
e.initEvent(expectedEvent, true, true);
|
||||
w.applicationCache["on" + expectedEvent] = eventHandler;
|
||||
w.applicationCache.addEventListener(expectedEvent, eventHandler, true);
|
||||
w.applicationCache.dispatchEvent(e);
|
||||
is(count, 2, "Wrong number events!");
|
||||
w.applicationCache["on" + expectedEvent] = null;
|
||||
w.applicationCache.removeEventListener(expectedEvent, eventHandler, true);
|
||||
w.applicationCache.dispatchEvent(e);
|
||||
is(count, 2, "Wrong number events!");
|
||||
}
|
||||
|
||||
// Test some random event.
|
||||
count = 0;
|
||||
expectedEvent = "foo";
|
||||
e = w.document.createEvent("event");
|
||||
e.initEvent(expectedEvent, true, true);
|
||||
w.applicationCache.addEventListener(expectedEvent, eventHandler, true);
|
||||
w.applicationCache.dispatchEvent(e);
|
||||
is(count, 1, "Wrong number events!");
|
||||
w.applicationCache.removeEventListener(expectedEvent, eventHandler, true);
|
||||
w.applicationCache.dispatchEvent(e);
|
||||
is(count, 1, "Wrong number events!");
|
||||
}
|
||||
|
||||
function loaded() {
|
||||
testEventHandling();
|
||||
|
||||
// Click the notification panel's "Allow" button. This should kick
|
||||
// off updates, which will eventually lead to getting messages from
|
||||
// the children.
|
||||
var win = SpecialPowers.Services.wm.getMostRecentWindow("navigator:browser");
|
||||
var panel = win.PopupNotifications.panel;
|
||||
is(panel.childElementCount, 2, "2 notifications being displayed");
|
||||
panel.firstElementChild.button.click();
|
||||
|
||||
// should have dismissed one of the notifications.
|
||||
is(panel.childElementCount, 1, "1 notification now being displayed");
|
||||
panel.firstElementChild.button.click();
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(loaded);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -22,6 +22,7 @@ support-files =
|
||||
browser_cmd_appcache_invalid_page3.html
|
||||
browser_cmd_appcache_invalid_page3.html^headers^
|
||||
[browser_cmd_appcache_valid.js]
|
||||
skip-if = !e10s
|
||||
support-files =
|
||||
browser_cmd_appcache_valid_appcache.appcache
|
||||
browser_cmd_appcache_valid_appcache.appcache^headers^
|
||||
|
@ -1,10 +1,11 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
// Tests that the appcache validate works as they should with an invalid
|
||||
// manifest.
|
||||
|
||||
const TEST_URI = "http://sub1.test1.example.com/browser/devtools/client/commandline/" +
|
||||
const TEST_URI = "https://sub1.test1.example.com/browser/devtools/client/commandline/" +
|
||||
"test/browser_cmd_appcache_invalid_index.html";
|
||||
|
||||
function test() {
|
||||
@ -36,26 +37,26 @@ function* spawnTest() {
|
||||
"test.png points to a resource that is not available at line 25.",
|
||||
"/main/features.js points to a resource that is not available at line 27.",
|
||||
"/main/settings/index.css points to a resource that is not available at line 28.",
|
||||
"http://example.com/scene.jpg points to a resource that is not available at line 29.",
|
||||
"https://example.com/scene.jpg points to a resource that is not available at line 29.",
|
||||
"/section1/blockedbyfallback.html points to a resource that is not available at line 30.",
|
||||
"http://example.com/images/world.jpg points to a resource that is not available at line 31.",
|
||||
"https://example.com/images/world.jpg points to a resource that is not available at line 31.",
|
||||
"/section2/blockedbyfallback.html points to a resource that is not available at line 32.",
|
||||
"/main/home points to a resource that is not available at line 34.",
|
||||
"main/app.js points to a resource that is not available at line 35.",
|
||||
"/settings/home points to a resource that is not available at line 37.",
|
||||
"/settings/app.js points to a resource that is not available at line 38.",
|
||||
"The file http://sub1.test1.example.com/browser/devtools/client/" +
|
||||
"The file https://sub1.test1.example.com/browser/devtools/client/" +
|
||||
"commandline/test/browser_cmd_appcache_invalid_page3.html was modified " +
|
||||
"after http://sub1.test1.example.com/browser/devtools/client/" +
|
||||
"after https://sub1.test1.example.com/browser/devtools/client/" +
|
||||
"commandline/test/browser_cmd_appcache_invalid_appcache.appcache. Unless " +
|
||||
"the text in the manifest file is changed the cached version will be used " +
|
||||
"instead at line 39.",
|
||||
"browser_cmd_appcache_invalid_page3.html has cache-control set to no-store. " +
|
||||
"This will prevent the application cache from storing the file at line 39.",
|
||||
"http://example.com/logo.png points to a resource that is not available at line 40.",
|
||||
"http://example.com/check.png points to a resource that is not available at line 41.",
|
||||
"https://example.com/logo.png points to a resource that is not available at line 40.",
|
||||
"https://example.com/check.png points to a resource that is not available at line 41.",
|
||||
"Spaces in URIs need to be replaced with %20 at line 42.",
|
||||
"http://example.com/cr oss.png points to a resource that is not available at line 42.",
|
||||
"https://example.com/cr oss.png points to a resource that is not available at line 42.",
|
||||
"Asterisk (*) incorrectly used in the CACHE section at line 43. If a line " +
|
||||
"in the NETWORK section contains only a single asterisk character, then " +
|
||||
"any URI not listed in the manifest will be treated as if the URI was " +
|
||||
|
@ -26,9 +26,9 @@ test.png
|
||||
browser_cmd_appcache_invalid_index.html
|
||||
/main/features.js
|
||||
/main/settings/index.css
|
||||
http://example.com/scene.jpg
|
||||
https://example.com/scene.jpg
|
||||
/section1/blockedbyfallback.html
|
||||
http://example.com/images/world.jpg
|
||||
https://example.com/images/world.jpg
|
||||
/section2/blockedbyfallback.html
|
||||
browser_cmd_appcache_invalid_page1.html
|
||||
/main/home
|
||||
@ -37,9 +37,9 @@ browser_cmd_appcache_invalid_page2.html
|
||||
/settings/home
|
||||
/settings/app.js
|
||||
browser_cmd_appcache_invalid_page3.html
|
||||
http://example.com/logo.png
|
||||
http://example.com/check.png
|
||||
http://example.com/cr oss.png
|
||||
https://example.com/logo.png
|
||||
https://example.com/check.png
|
||||
https://example.com/cr oss.png
|
||||
/checking*.png
|
||||
|
||||
SETTINGS:
|
||||
|
@ -1,9 +1,10 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
// Tests that the appcache commands works as they should
|
||||
|
||||
const TEST_URI = "http://sub1.test2.example.com/browser/devtools/client/" +
|
||||
const TEST_URI = "https://sub1.test2.example.com/browser/devtools/client/" +
|
||||
"commandline/test/browser_cmd_appcache_valid_index.html";
|
||||
|
||||
function test() {
|
||||
@ -110,7 +111,7 @@ function* spawnTest() {
|
||||
setup: "appcache validate " + TEST_URI,
|
||||
check: {
|
||||
input: "appcache validate " + TEST_URI,
|
||||
// appcache validate http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html
|
||||
// appcache validate https://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html
|
||||
markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
||||
status: "VALID",
|
||||
args: {
|
||||
@ -160,7 +161,7 @@ function* spawnTest() {
|
||||
setup: "appcache viewentry --key " + TEST_URI,
|
||||
check: {
|
||||
input: "appcache viewentry --key " + TEST_URI,
|
||||
// appcache viewentry --key http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html
|
||||
// appcache viewentry --key https://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html
|
||||
markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
||||
status: "VALID",
|
||||
args: {}
|
||||
|
@ -32,6 +32,7 @@ DEPRECATED_OPERATION(NavigatorGetUserMedia)
|
||||
DEPRECATED_OPERATION(WebrtcDeprecatedPrefix)
|
||||
DEPRECATED_OPERATION(RTCPeerConnectionGetStreams)
|
||||
DEPRECATED_OPERATION(AppCache)
|
||||
DEPRECATED_OPERATION(AppCacheInsecure)
|
||||
DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled)
|
||||
DEPRECATED_OPERATION(PrefixedFullscreenAPI)
|
||||
DEPRECATED_OPERATION(LenientSetter)
|
||||
|
@ -2973,6 +2973,13 @@ nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj)
|
||||
nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsGlobalWindowInner::OfflineCacheAllowedForContext(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
return IsSecureContextOrObjectIsFromSecureContext(aCx, aObj) ||
|
||||
Preferences::GetBool("browser.cache.offline.insecure.enable");
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsGlobalWindowInner::IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
|
@ -399,6 +399,8 @@ public:
|
||||
|
||||
static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj);
|
||||
|
||||
static bool OfflineCacheAllowedForContext(JSContext* /* unused */, JSObject* aObj);
|
||||
|
||||
static bool IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* /* unused */);
|
||||
|
||||
static bool IsWindowPrintEnabled(JSContext* /* unused */, JSObject* /* unused */);
|
||||
|
@ -187,6 +187,8 @@ HittingMaxWorkersPerDomain2=A Worker could not be started immediately because ot
|
||||
PannerNodeDopplerWarning=Use of setVelocity on the PannerNode and AudioListener, and speedOfSound and dopplerFactor on the AudioListener are deprecated and those members will be removed. For more help https://developer.mozilla.org/en-US/docs/Web/API/AudioListener#Deprecated_features
|
||||
# LOCALIZATION NOTE: Do not translate "Application Cache API", "AppCache" and "ServiceWorker".
|
||||
AppCacheWarning=The Application Cache API (AppCache) is deprecated and will be removed at a future date. Please consider using ServiceWorker for offline support.
|
||||
# LOCALIZATION NOTE: Do not translate "Application Cache API", "AppCache".
|
||||
AppCacheInsecureWarning=Use of the Application Cache API (AppCache) for insecure connections will be removed in version 62.
|
||||
# LOCALIZATION NOTE: Do not translate "Worker".
|
||||
EmptyWorkerSourceWarning=Attempting to create a Worker from an empty source. This is probably unintentional.
|
||||
WebrtcDeprecatedPrefixWarning=WebRTC interfaces with the “moz” prefix (mozRTCPeerConnection, mozRTCSessionDescription, mozRTCIceCandidate) have been deprecated.
|
||||
|
9
dom/tests/mochitest/ajax/offline/.eslintrc.js
Normal file
9
dom/tests/mochitest/ajax/offline/.eslintrc.js
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"globals": {
|
||||
"SimpleTest": true,
|
||||
"OfflineTest": true,
|
||||
"SpecialPowers": true,
|
||||
}
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
CACHE MANIFEST
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
test_bug445544.html
|
||||
445544_part1.html
|
||||
|
@ -1,7 +1,7 @@
|
||||
CACHE MANIFEST
|
||||
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
# more than 15 what is a number of parallel loads
|
||||
subresource744719.html?001
|
||||
|
@ -1,7 +1,7 @@
|
||||
CACHE MANIFEST
|
||||
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
# more than 15 what is a number of parallel loads
|
||||
subresource744719.html?001
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This doesn't start with the magic cache manifest line.
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
8
dom/tests/mochitest/ajax/offline/browser.ini
Normal file
8
dom/tests/mochitest/ajax/offline/browser.ini
Normal file
@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
file_simpleManifest.html
|
||||
file_testFile.sjs
|
||||
file_simpleManifest.cacheManifest
|
||||
|
||||
[browser_disableAppcache.js]
|
||||
skip-if = !e10s || (toolkit == 'android') || debug # Slow
|
134
dom/tests/mochitest/ajax/offline/browser_disableAppcache.js
Normal file
134
dom/tests/mochitest/ajax/offline/browser_disableAppcache.js
Normal file
@ -0,0 +1,134 @@
|
||||
const PATH =
|
||||
"http://example.com/browser/dom/tests/mochitest/ajax/offline/";
|
||||
const URL = PATH + "file_simpleManifest.html";
|
||||
const MANIFEST = PATH + "file_simpleManifest.cacheManifest";
|
||||
const PREF_INSECURE_APPCACHE = "browser.cache.offline.insecure.enable";
|
||||
const PREF_NETWORK_PROXY = "network.proxy.type";
|
||||
|
||||
function setSJSState(sjsPath, stateQuery) {
|
||||
let client = new XMLHttpRequest();
|
||||
client.open("GET", sjsPath + "?state=" + stateQuery, false);
|
||||
let appcachechannel = SpecialPowers.wrap(client).channel.QueryInterface(Ci.nsIApplicationCacheChannel);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
client.addEventListener("load", resolve);
|
||||
client.addEventListener("error", reject);
|
||||
|
||||
appcachechannel.chooseApplicationCache = false;
|
||||
appcachechannel.inheritApplicationCache = false;
|
||||
appcachechannel.applicationCache = null;
|
||||
|
||||
client.send();
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
/* This test loads "evil" content and verified it isn't loaded when appcache is disabled, which emulates loading stale cache from an untrusted network:
|
||||
- Sets frame to load "evil" content
|
||||
- Loads HTML file which also loads and caches content into AppCache
|
||||
- Sets frame to load "good"
|
||||
- Check we still have "evil" content from AppCache
|
||||
- Disables appcache
|
||||
- Check content is "good"
|
||||
*/
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, true]
|
||||
]
|
||||
});
|
||||
await setSJSState(PATH + "file_testFile.sjs", "evil");
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
|
||||
let windowPromise = new Promise((resolve, reject) => {
|
||||
function init() {
|
||||
if (content.document.readyState == "complete") {
|
||||
const frame = content.document.getElementById("childframe");
|
||||
const state = frame.contentDocument.getElementById("state");
|
||||
is(state.textContent, "evil", "Loaded evil content");
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
content.document.onreadystatechange = init;
|
||||
init();
|
||||
});
|
||||
let appcachePromise = new Promise((resolve, reject) => {
|
||||
function appcacheInit() {
|
||||
if (content.applicationCache.status === content.applicationCache.IDLE) {
|
||||
ok(true, "Application cache loaded");
|
||||
resolve();
|
||||
} else {
|
||||
info("State was: " + content.applicationCache.status);
|
||||
}
|
||||
}
|
||||
content.applicationCache.oncached = appcacheInit;
|
||||
content.applicationCache.onnoupdate = appcacheInit;
|
||||
content.applicationCache.onerror = () => {
|
||||
ok(false, "Application cache failed");
|
||||
reject();
|
||||
};
|
||||
appcacheInit();
|
||||
});
|
||||
await Promise.all([windowPromise, appcachePromise]);
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
// Turn network and proxy off so we can check the content loads still
|
||||
await setSJSState(PATH + "file_testFile.sjs", "good");
|
||||
Services.cache2.clear();
|
||||
|
||||
// Check we still have the "evil" content despite the state change
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
|
||||
const frame = content.document.getElementById("childframe");
|
||||
const state = frame.contentDocument.getElementById("state");
|
||||
is(state.textContent, "evil", "Loaded evil content from cache");
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, false]
|
||||
]
|
||||
});
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
|
||||
// Check that the "good" content is back now appcache is disabled
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, [URL], async (URL) => {
|
||||
const frame = content.document.getElementById("childframe");
|
||||
const state = frame.contentDocument.getElementById("state");
|
||||
is(state.textContent, "good", "Loaded good content");
|
||||
// Eval is needed to execure in child context.
|
||||
content.window.eval("OfflineTest.clear()");
|
||||
});
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
await setSJSState(PATH + "file_testFile.sjs", "");
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_pref_removes_api() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, true]
|
||||
]
|
||||
});
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
|
||||
// Have to use in page checking as IsSecureContextOrObjectIsFromSecureContext is true for spawn()
|
||||
is(content.document.getElementById("hasAppcache").textContent, "yes", "Appcache is enabled");
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_INSECURE_APPCACHE, false]
|
||||
]
|
||||
});
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, [URL], async (URL) => {
|
||||
is(content.document.getElementById("hasAppcache").textContent, "no", "Appcache is disabled");
|
||||
content.window.eval("OfflineTest.clear()");
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
@ -14,7 +14,7 @@ function handleRequest(request, response)
|
||||
{
|
||||
case "": // The default value
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader("Location", "http://example.com/non-existing-dynamic.html");
|
||||
response.setHeader("Location", "https://example.org/non-existing-dynamic.html");
|
||||
response.setHeader("Content-Type", "text/html");
|
||||
break;
|
||||
case "on":
|
||||
|
@ -14,7 +14,7 @@ function handleRequest(request, response)
|
||||
{
|
||||
case "": // The default value
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader("Location", "http://example.com/non-existing-explicit.html");
|
||||
response.setHeader("Location", "https://example.com/non-existing-explicit.html");
|
||||
response.setHeader("Content-Type", "text/html");
|
||||
break;
|
||||
case "on":
|
||||
|
@ -1,6 +1,6 @@
|
||||
CACHE MANIFEST
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
FALLBACK:
|
||||
namespace1/ fallback.html
|
||||
|
@ -0,0 +1,5 @@
|
||||
CACHE MANIFEST
|
||||
http://example.com/browser/dom/tests/mochitest/ajax/offline/file_testFile.sjs
|
||||
http://example.com/browser/dom/tests/mochitest/ajax/offline/file_simpleManifest.html
|
||||
http://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
20
dom/tests/mochitest/ajax/offline/file_simpleManifest.html
Normal file
20
dom/tests/mochitest/ajax/offline/file_simpleManifest.html
Normal file
@ -0,0 +1,20 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://example.com/browser/dom/tests/mochitest/ajax/offline/file_simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>load manifest test</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", () => {
|
||||
const hasAppcache = document.getElementById("hasAppcache");
|
||||
hasAppcache.textContent = "applicationCache" in window ? "yes" : "no";
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="http://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Offline testing<br />
|
||||
We have AppCache: <span id="hasAppcache"></span><br />
|
||||
|
||||
<iframe id="childframe" src="http://example.com/browser/dom/tests/mochitest/ajax/offline/file_testFile.sjs" ></iframe>
|
||||
</body>
|
||||
</html>
|
25
dom/tests/mochitest/ajax/offline/file_testFile.sjs
Normal file
25
dom/tests/mochitest/ajax/offline/file_testFile.sjs
Normal file
@ -0,0 +1,25 @@
|
||||
function handleRequest(request, response) {
|
||||
var match = request.queryString.match(/^state=(.*)$/);
|
||||
if (match) {
|
||||
response.setStatusLine(request.httpVersion, 204, "No content");
|
||||
setState("version", match[1]);
|
||||
return;
|
||||
}
|
||||
const state = getState("version");
|
||||
let color = "green";
|
||||
if (state === "evil") {
|
||||
color = "red";
|
||||
}
|
||||
const frameContent = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>body,html {background: ${color};}</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Offline file: <span id="state">${state}</span></h1>
|
||||
`;
|
||||
response.setHeader("Content-Type", "text/html");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.write(frameContent);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest">
|
||||
<head>
|
||||
<title>Foreign page 2</title>
|
||||
|
||||
@ -14,13 +14,13 @@ function manifestUpdated()
|
||||
.getService(SpecialPowers.Ci.nsIApplicationCacheService);
|
||||
|
||||
var foreign2cache = appCacheService.chooseApplicationCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
|
||||
|
||||
window.opener.OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html");
|
||||
window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest")
|
||||
window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest");
|
||||
|
||||
var foreign1cache = OfflineTest.getActiveCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
|
||||
window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded");
|
||||
foreign1cache.discard();
|
||||
|
||||
@ -33,15 +33,15 @@ function onLoaded()
|
||||
.getService(SpecialPowers.Ci.nsIApplicationCacheService);
|
||||
|
||||
var foreign1cache = window.opener.OfflineTest.getActiveCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
|
||||
window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded");
|
||||
|
||||
var foreign2cache = window.opener.OfflineTest.getActiveCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest");
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest");
|
||||
window.opener.OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present");
|
||||
|
||||
foreign1cache = appCacheService.chooseApplicationCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContextInfo());
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContextInfo());
|
||||
window.opener.OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache");
|
||||
|
||||
try
|
||||
|
@ -1,6 +1,6 @@
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader("Location", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updating.cacheManifest");
|
||||
response.setHeader("Location", "https://example.com/tests/dom/tests/mochitest/ajax/offline/updating.cacheManifest");
|
||||
response.setHeader("Content-Type", "text/cache-manifest");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
CACHE MANIFEST
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
# The following item doesn't exist, and will cause an update error.
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/doesntExist.html
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/doesntExist.html
|
||||
|
@ -1,4 +1,5 @@
|
||||
[DEFAULT]
|
||||
scheme = https
|
||||
skip-if = toolkit == 'android' || e10s #SLOW_DIRECTORY
|
||||
support-files =
|
||||
445544.cacheManifest
|
||||
|
@ -1,6 +1,6 @@
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader("Location", "http://example.org/tests/dom/tests/mochitest/ajax/offline/fallback2.html");
|
||||
response.setHeader("Location", "https://example.org/tests/dom/tests/mochitest/ajax/offline/fallback2.html");
|
||||
response.setHeader("Content-Type", "text/html");
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ applicationCache.oncached = function() {
|
||||
|
||||
// Make the obsoleting.sjs return 404 NOT FOUND code
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=");
|
||||
req.open("GET", "https://example.com/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=");
|
||||
var channel = SpecialPowers.wrap(req).channel
|
||||
.QueryInterface(SpecialPowers.Ci.nsIApplicationCacheChannel);
|
||||
channel.chooseApplicationCache = false;
|
||||
|
@ -323,8 +323,16 @@ getActiveCache: function(overload)
|
||||
// one associated with this window.
|
||||
var serv = Cc["@mozilla.org/network/application-cache-service;1"]
|
||||
.getService(Ci.nsIApplicationCacheService);
|
||||
|
||||
var groupID = serv.buildGroupIDForInfo(this.manifestURL(overload), this.loadContextInfo());
|
||||
return serv.getActiveCache(groupID);
|
||||
var cache;
|
||||
// Sometimes this throws a NS_ERROR_UNEXPECTED when cache isn't init
|
||||
try {
|
||||
cache = serv.getActiveCache(groupID);
|
||||
} catch (e) {
|
||||
cache = false;
|
||||
}
|
||||
return cache;
|
||||
},
|
||||
|
||||
getActiveStorage: function()
|
||||
|
@ -1,8 +1,8 @@
|
||||
CACHE MANIFEST
|
||||
|
||||
CACHE:
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
NETWORK:
|
||||
bogus/specific/
|
||||
|
@ -2,25 +2,25 @@ ver1manifest =
|
||||
"CACHE MANIFEST\n" +
|
||||
"# v1\n" +
|
||||
"\n" +
|
||||
"http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
|
||||
"https://example.com/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
|
||||
|
||||
ver2manifest =
|
||||
"CACHE MANIFEST\n" +
|
||||
"# v2\n" +
|
||||
"\n" +
|
||||
"http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
|
||||
"https://example.com/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
|
||||
|
||||
ver3manifest =
|
||||
"CACHE MANIFEST\n" +
|
||||
"# v3\n" +
|
||||
"\n" +
|
||||
"http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
|
||||
"https://example.com/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
|
||||
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
CACHE MANIFEST
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
# The following item is not a valid URI and will be ignored
|
||||
bad:/uri/invalid
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest">
|
||||
<head>
|
||||
<title>bad manifest magic</title>
|
||||
|
||||
@ -21,8 +21,8 @@ function handleError() {
|
||||
// These items are listed in the manifest, but the error should have
|
||||
// prevented them from being committed to the cache.
|
||||
var entries = [
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, finishTest);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>Bug 460353</title>
|
||||
|
||||
@ -73,8 +73,8 @@ function finish()
|
||||
SimpleTest.is(result["noman"].cacheStatus || -1, -1, "Frame with no manifest cache status was undefined");
|
||||
|
||||
OfflineTest.waitForUpdates(function() {
|
||||
cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest");
|
||||
cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs");
|
||||
cleanCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest");
|
||||
cleanCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.cacheManifest">
|
||||
<head>
|
||||
<title>Fallback on different origin redirect test</title>
|
||||
|
||||
@ -7,9 +7,11 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
/* globals fallbackFrame */
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs";
|
||||
fallbackFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs";
|
||||
// Invokes load of fallback.html
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest">
|
||||
<head>
|
||||
<title>wildcard in network section test</title>
|
||||
|
||||
@ -47,7 +47,7 @@ SimpleTest.waitForExplicitFinish();
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<img src="http://example.com/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg" onload="imageOnLoad(1)" />
|
||||
<img src="https://example.org/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg" onload="imageOnLoad(1)" />
|
||||
<img src="jupiter.jpg" onload="imageOnLoad(2)" />
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest">
|
||||
<head>
|
||||
<title>parallel load canceled</title>
|
||||
|
||||
@ -21,13 +21,13 @@ if (SpecialPowers.isMainProcess()) {
|
||||
|
||||
function updateCanceled()
|
||||
{
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest", false, null);
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false, null);
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false, null);
|
||||
OfflineTest.checkCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest", false, null);
|
||||
OfflineTest.checkCache("https://example.com/tests/SimpleTest/SimpleTest.js", false, null);
|
||||
OfflineTest.checkCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false, null);
|
||||
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/nonexistent744719?010", false, null);
|
||||
OfflineTest.checkCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/nonexistent744719?010", false, null);
|
||||
|
||||
var URL = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?";
|
||||
var URL = "https://example.com/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?";
|
||||
OfflineTest.checkCache(URL + "001", false, null);
|
||||
OfflineTest.checkCache(URL + "002", false, null);
|
||||
OfflineTest.checkCache(URL + "003", false, null);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="/tests/dom/tests/mochitest/ajax/offline/744719.cacheManifest">
|
||||
<head>
|
||||
<title>parallel load</title>
|
||||
|
||||
@ -20,11 +20,12 @@ if (SpecialPowers.isMainProcess()) {
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719.cacheManifest", true);
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true);
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true);
|
||||
ok(window.location.href, "my loc" + window.location.href);
|
||||
OfflineTest.checkCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/744719.cacheManifest", true);
|
||||
OfflineTest.checkCache("https://example.com/tests/SimpleTest/SimpleTest.js", true);
|
||||
OfflineTest.checkCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true);
|
||||
|
||||
var URL = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?";
|
||||
var URL = "https://example.com/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?";
|
||||
OfflineTest.checkCache(URL + "001", true);
|
||||
OfflineTest.checkCache(URL + "002", true);
|
||||
OfflineTest.checkCache(URL + "003", true);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest">
|
||||
<head>
|
||||
<title>unknown section</title>
|
||||
|
||||
@ -20,17 +20,17 @@ function manifestUpdated()
|
||||
|
||||
var entries = [
|
||||
// The manifest itself should be in the cache
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest", true],
|
||||
|
||||
// The document that requested the manifest should be in the cache
|
||||
[window.location.href, true],
|
||||
|
||||
// The entries from the manifest should be in the cache
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
|
||||
// The bad entries from the manifest should not be in the cache
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg", false]
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg", false]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(
|
||||
entries,
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>Cancel offline cache</title>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
|
||||
var manifest = "https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
|
||||
var manifestURI = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newURI(manifest);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
|
||||
<head>
|
||||
<title>changing manifest test</title>
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
var gGotChecking = false;
|
||||
var gGotDownloading = false;
|
||||
|
||||
var g1SecUrl = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changing1Sec.sjs";
|
||||
var g1HourUrl = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changing1Hour.sjs";
|
||||
var g1SecUrl = "https://example.com/tests/dom/tests/mochitest/ajax/offline/changing1Sec.sjs";
|
||||
var g1HourUrl = "https://example.com/tests/dom/tests/mochitest/ajax/offline/changing1Hour.sjs";
|
||||
|
||||
var gCacheContents = null;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.cacheManifest">
|
||||
<head>
|
||||
<title>Fallback entry test</title>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
/* globals fallbackFrame */
|
||||
|
||||
/**
|
||||
* This tests that we fall back to the correct fallback entries when loading
|
||||
@ -22,7 +23,7 @@ var gTopWindow = null;
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html";
|
||||
fallbackFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html";
|
||||
// Invokes load of fallback.html
|
||||
}
|
||||
|
||||
@ -37,7 +38,7 @@ function onFallbackLoad(fallbackIdentification)
|
||||
case 101:
|
||||
OfflineTest.is(fallbackIdentification, 1, "fallback for namespace1/ in step " + gStep);
|
||||
|
||||
fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html";
|
||||
fallbackFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html";
|
||||
// Invokes load of fallback.html
|
||||
break;
|
||||
|
||||
@ -45,7 +46,7 @@ function onFallbackLoad(fallbackIdentification)
|
||||
case 102:
|
||||
OfflineTest.is(fallbackIdentification, 1, "fallback for namespace1/, sub namespace in name of the frame in step " + gStep);
|
||||
|
||||
fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html";
|
||||
fallbackFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html";
|
||||
// Invokes load of fallback2.html
|
||||
break;
|
||||
|
||||
@ -53,7 +54,7 @@ function onFallbackLoad(fallbackIdentification)
|
||||
case 103:
|
||||
OfflineTest.is(fallbackIdentification, 2, "fallback for namespace1/sub/ in step " + gStep);
|
||||
|
||||
fallbackFrame.location = "HTTP://MOCHI.TEST:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html";
|
||||
fallbackFrame.location = "HTTPS://EXAMPLE.COM/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html";
|
||||
// Invokes load of fallback2.html
|
||||
break;
|
||||
|
||||
@ -64,7 +65,7 @@ function onFallbackLoad(fallbackIdentification)
|
||||
// Try opening a non-existing page as a top level document. It must
|
||||
// fall to fallbackTop.html that identifies it self as '100'.
|
||||
// Invokes load of fallbackTop.html
|
||||
gTopWindow = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace2/non-existing.html");
|
||||
gTopWindow = window.open("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace2/non-existing.html");
|
||||
|
||||
break;
|
||||
|
||||
@ -73,7 +74,7 @@ function onFallbackLoad(fallbackIdentification)
|
||||
// pages created/leaked. That would prevent fallback load.
|
||||
gStep = 100;
|
||||
|
||||
fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html";
|
||||
fallbackFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html";
|
||||
// Invokes load of fallback1.html, again, from the start
|
||||
// no break
|
||||
case 105:
|
||||
@ -102,10 +103,10 @@ function finishTest()
|
||||
function finalize()
|
||||
{
|
||||
var entries = [
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace2/non-existing.html", false]
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace2/non-existing.html", false]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, finishTest);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest">
|
||||
<head>
|
||||
<title>Foreign test</title>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
/* globals foreign1cache */
|
||||
|
||||
/**
|
||||
* This test loads a manifest that contains as an explicit entry
|
||||
@ -27,12 +28,12 @@ function manifestUpdated()
|
||||
.getService(SpecialPowers.Ci.nsIApplicationCacheService);
|
||||
|
||||
foreign1cache = appCacheService.chooseApplicationCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
|
||||
|
||||
OfflineTest.ok(foreign1cache, "foreign2.html chosen from foreign1 cache");
|
||||
OfflineTest.is(foreign1cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest")
|
||||
OfflineTest.is(foreign1cache.manifestURI.asciiSpec, "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
|
||||
|
||||
win = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
|
||||
win = window.open("https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
|
||||
}
|
||||
|
||||
function onDone() // called by the open window after stuff is finished
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>identical manifest test</title>
|
||||
|
||||
@ -25,8 +25,8 @@ function noUpdate()
|
||||
// The document that requested the manifest should be in the cache
|
||||
[window.location.href, true],
|
||||
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true]
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, finishTest);
|
||||
}
|
||||
@ -38,14 +38,14 @@ function manifestUpdated()
|
||||
|
||||
var entries = [
|
||||
// The manifest itself should be in the cache
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
|
||||
|
||||
// The document that requested the manifest should be in the cache
|
||||
[window.location.href, true],
|
||||
|
||||
// The entries from the manifest should be in the cache
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
|
||||
// The bad entries from the manifest should not be in the cache
|
||||
["bad:/uri/invalid", false]
|
||||
|
@ -70,7 +70,7 @@ if (OfflineTest.setup()) {
|
||||
applicationCacheAvailable: function() {}
|
||||
});
|
||||
|
||||
var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
|
||||
var manifest = "https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var manifestURI = ioService.newURI(manifest);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>Low device storage during update</title>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest">
|
||||
<head>
|
||||
<title>missing manifest file test</title>
|
||||
|
||||
@ -23,8 +23,8 @@ function handleError() {
|
||||
// These items are listed in the manifest, but the error should have
|
||||
// prevented them from being committed to the cache.
|
||||
var entries = [
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, finishTest);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ SpecialPowers.pushPermissions([{'type': 'offline-app', 'allow': true, 'context':
|
||||
function startTest() {
|
||||
// Make the obsoleting.sjs return a valid manifest
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=manifestPresent");
|
||||
req.open("GET", "https://example.com/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=manifestPresent");
|
||||
req.setRequestHeader("Content-Type", "text/cache-manifest");
|
||||
req.send("");
|
||||
req.onreadystatechange = function() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>offline iframe test</title>
|
||||
|
||||
@ -12,11 +12,11 @@
|
||||
function checkEntries() {
|
||||
var entries = [
|
||||
// The manifest itself should be in the cache
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
|
||||
|
||||
// The entries from the manifest should be in the cache
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true]
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, function() { window.frames["offlineChild"].doneLoading(); });
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<head>
|
||||
<title>Offline mode test</title>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
/* globals aFrame */
|
||||
|
||||
/**
|
||||
* The test loads a manifest and cache it.
|
||||
@ -34,27 +35,27 @@ function createURI(urispec)
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
applicationCache.mozAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html");
|
||||
OfflineTest.waitForAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html", dynamicAdded);
|
||||
applicationCache.mozAdd("https://example.com/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html");
|
||||
OfflineTest.waitForAdd("https://example.com/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html", dynamicAdded);
|
||||
}
|
||||
|
||||
function dynamicAdded()
|
||||
{
|
||||
aFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html";
|
||||
aFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html";
|
||||
}
|
||||
|
||||
// Called by the dynamically added iframe on load
|
||||
function notwhitelistOnLoad()
|
||||
{
|
||||
gGotDynamicVersion = 1;
|
||||
aFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs";
|
||||
aFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs";
|
||||
}
|
||||
|
||||
// Called by the explicit iframe on load
|
||||
function frameLoad(version)
|
||||
{
|
||||
gGotExplicitVersion = version;
|
||||
gImplicitWindow = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html");
|
||||
gImplicitWindow = window.open("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html");
|
||||
}
|
||||
|
||||
// Called by the implicit window on load
|
||||
@ -63,7 +64,7 @@ function implicitLoaded(aWindow, errorOccured)
|
||||
aWindow.close();
|
||||
|
||||
gGotImplicitVersion = 1;
|
||||
OfflineTest.waitForAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", implicitAdded);
|
||||
OfflineTest.waitForAdd("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", implicitAdded);
|
||||
}
|
||||
|
||||
function implicitAdded()
|
||||
@ -89,9 +90,9 @@ function finalize()
|
||||
gGotDynamicVersion = 0;
|
||||
|
||||
var entries = [
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true]
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, goOffline);
|
||||
}
|
||||
@ -122,9 +123,9 @@ function goOffline()
|
||||
var cache = Cc["@mozilla.org/network/cache-storage-service;1"]
|
||||
.getService(Ci.nsICacheStorageService);
|
||||
var storage = cache.diskCacheStorage(LoadContextInfo.default, false);
|
||||
storage.asyncDoomURI(createURI("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html"), "", null);
|
||||
storage.asyncDoomURI(createURI("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs"), "", null);
|
||||
storage.asyncDoomURI(createURI("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html"), "", listener);
|
||||
storage.asyncDoomURI(createURI("https://example.com/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html"), "", null);
|
||||
storage.asyncDoomURI(createURI("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs"), "", null);
|
||||
storage.asyncDoomURI(createURI("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html"), "", listener);
|
||||
}
|
||||
|
||||
function goOfflineContinue()
|
||||
@ -140,7 +141,7 @@ function goOfflineContinue()
|
||||
// is correct to get error message
|
||||
applicationCache.onerror = function() {gGotOnError = true;}
|
||||
|
||||
aFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html";
|
||||
aFrame.location = "https://example.com/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html";
|
||||
// Starts the chain all over again but in offline mode.
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/overlap.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/overlap.cacheManifest">
|
||||
<head>
|
||||
<title>overlapping namespaces test</title>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs">
|
||||
<head>
|
||||
<title>Fail update on manifest redirection test</title>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/redirects.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/redirects.sjs">
|
||||
<head>
|
||||
<title>Entries redirection handling during update test</title>
|
||||
|
||||
@ -13,8 +13,8 @@ var gCurrentManifestVersion = 1;
|
||||
function manifestCached()
|
||||
{
|
||||
var entries = [
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs", true],
|
||||
];
|
||||
OfflineTest.checkCacheEntries(entries, manifestCachedContinue);
|
||||
}
|
||||
@ -25,25 +25,25 @@ function manifestCachedContinue()
|
||||
|
||||
// Now add one dynamic entry (now with content overriden redirect sjs)
|
||||
applicationCache.mozAdd(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs");
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs");
|
||||
|
||||
// Wait for the dynamic entry be added to the cache...
|
||||
OfflineTest.waitForAdd(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
function() {
|
||||
// ...check it is there...
|
||||
OfflineTest.checkCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
true,
|
||||
function() {
|
||||
// ...revert state of the dynamic entry on the server, now we get the redirect...
|
||||
OfflineTest.setSJSState(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"");
|
||||
|
||||
// ...update manifest to the new version on the server...
|
||||
OfflineTest.setSJSState(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/redirects.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/redirects.sjs",
|
||||
"second");
|
||||
gCurrentManifestVersion = 2;
|
||||
|
||||
@ -60,17 +60,17 @@ function manifestUpdated()
|
||||
case 2:
|
||||
// Check the dynamic entry was removed from the cache (because of the redirect)...
|
||||
OfflineTest.checkCache(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
false,
|
||||
function () {
|
||||
// ...return back redirect for the explicit entry...
|
||||
OfflineTest.setSJSState(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs",
|
||||
"");
|
||||
|
||||
// ...update the manifest to the third version...
|
||||
OfflineTest.setSJSState(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/redirects.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/redirects.sjs",
|
||||
"third");
|
||||
gCurrentManifestVersion = 3;
|
||||
|
||||
@ -121,10 +121,10 @@ if (OfflineTest.setup()) {
|
||||
|
||||
// Override sjs redirects on the server, it will now return 200 OK and the content
|
||||
OfflineTest.setSJSState(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs",
|
||||
"on");
|
||||
OfflineTest.setSJSState(
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
|
||||
"on");
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
|
||||
<head>
|
||||
<title>refetch manifest test</title>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>simple manifest test</title>
|
||||
|
||||
@ -17,18 +17,18 @@ ok(applicationCache.mozItems.length == 0,
|
||||
function addFinished()
|
||||
{
|
||||
OfflineTest.ok(applicationCache.mozLength == 1, "applicationCache should have one dynamic entry (deprecated API)");
|
||||
OfflineTest.ok(applicationCache.mozItem(0) == "http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
|
||||
OfflineTest.ok(applicationCache.mozItem(0) == "https://example.com/tests/SimpleTest/EventUtils.js",
|
||||
"applicationCache's dynamic entry should be the one we expect (deprecated API)");
|
||||
|
||||
OfflineTest.ok(applicationCache.mozItems.length == 1, "applicationCache should have one dynamic entry");
|
||||
OfflineTest.ok(applicationCache.mozItems[0] == "http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
|
||||
OfflineTest.ok(applicationCache.mozItems[0] == "https://example.com/tests/SimpleTest/EventUtils.js",
|
||||
"applicationCache's dynamic entry should be the one we expect");
|
||||
|
||||
OfflineTest.ok(applicationCache.mozHasItem("http://mochi.test:8888/tests/SimpleTest/EventUtils.js"),
|
||||
OfflineTest.ok(applicationCache.mozHasItem("https://example.com/tests/SimpleTest/EventUtils.js"),
|
||||
"applicationCache.mozHasItem() should see the dynamic entry");
|
||||
|
||||
// Check that the entry was added successfully
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
|
||||
OfflineTest.checkCache("https://example.com/tests/SimpleTest/EventUtils.js",
|
||||
true,
|
||||
removeItem);
|
||||
}
|
||||
@ -36,16 +36,16 @@ function addFinished()
|
||||
function removeItem()
|
||||
{
|
||||
// Now test that removes work
|
||||
applicationCache.mozRemove("http://mochi.test:8888/tests/SimpleTest/EventUtils.js");
|
||||
applicationCache.mozRemove("https://example.com/tests/SimpleTest/EventUtils.js");
|
||||
|
||||
OfflineTest.ok(applicationCache.mozLength == 0,
|
||||
"applicationCache should have no dynamic entries (deprecated API)");
|
||||
OfflineTest.ok(applicationCache.mozItems.length == 0,
|
||||
"applicationCache should have no dynamic entries");
|
||||
OfflineTest.ok(!applicationCache.mozHasItem("http://mochi.test:8888/tests/SimpleTest/EventUtils.js"),
|
||||
OfflineTest.ok(!applicationCache.mozHasItem("https://example.com/tests/SimpleTest/EventUtils.js"),
|
||||
"applicationCache.mozHasItem() should not see the removed dynamic entry");
|
||||
|
||||
OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
|
||||
OfflineTest.checkCache("https://example.com/tests/SimpleTest/EventUtils.js",
|
||||
false,
|
||||
function() {
|
||||
// We're done
|
||||
@ -62,14 +62,14 @@ function manifestUpdated()
|
||||
|
||||
var entries = [
|
||||
// The manifest itself should be in the cache
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
|
||||
|
||||
// The document that requested the manifest should be in the cache
|
||||
[window.location.href, true],
|
||||
|
||||
// The entries from the manifest should be in the cache
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
|
||||
// The bad entries from the manifest should not be in the cache
|
||||
["bad:/uri/invalid", false]
|
||||
@ -87,10 +87,10 @@ function manifestUpdated()
|
||||
// XXX: make sure that the previous version went away after the swapCache().
|
||||
|
||||
// Now add a file using the applicationCache API
|
||||
applicationCache.mozAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js");
|
||||
applicationCache.mozAdd("https://example.com/tests/SimpleTest/EventUtils.js");
|
||||
|
||||
// Wait for the add() to be downloaded
|
||||
OfflineTest.waitForAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
|
||||
OfflineTest.waitForAdd("https://example.com/tests/SimpleTest/EventUtils.js",
|
||||
OfflineTest.priv(addFinished));
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<head>
|
||||
<title>Cache update test</title>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs";
|
||||
var manifest = "https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs";
|
||||
var manifestURI = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newURI(manifest);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<head>
|
||||
<title>Cache update test</title>
|
||||
|
||||
@ -113,7 +113,7 @@ function manifestCached()
|
||||
|
||||
reloadLocations([fallbackFrame1, fallbackFrame2]);
|
||||
waitForLocations(
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html"],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html"],
|
||||
fallbackLoaded
|
||||
);
|
||||
}
|
||||
@ -121,14 +121,14 @@ function manifestCached()
|
||||
function fallbackLoaded()
|
||||
{
|
||||
dump("in fallbackLoaded\n");
|
||||
applicationCache.mozAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js");
|
||||
OfflineTest.waitForAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
|
||||
applicationCache.mozAdd("https://example.com/tests/SimpleTest/EventUtils.js");
|
||||
OfflineTest.waitForAdd("https://example.com/tests/SimpleTest/EventUtils.js",
|
||||
dynamicLoaded);
|
||||
}
|
||||
|
||||
function dynamicLoaded()
|
||||
{
|
||||
window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html");
|
||||
window.open("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html");
|
||||
// window.applicationCache.noupdate invokes implicitLoaded()
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ function implicitLoaded(aWindow, errorOccured)
|
||||
|
||||
OfflineTest.ok(!errorOccured, "No error on new implicit page manifest update");
|
||||
|
||||
OfflineTest.waitForAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html",
|
||||
OfflineTest.waitForAdd("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html",
|
||||
implicitCached);
|
||||
}
|
||||
|
||||
@ -147,13 +147,13 @@ function implicitCached()
|
||||
// Checking first version of the manifest + another implict page caching
|
||||
|
||||
// Whitelist entries
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", true);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", true);
|
||||
|
||||
// Fallback URI selection check
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
|
||||
|
||||
// Cache object status
|
||||
OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.IDLE,
|
||||
@ -163,28 +163,28 @@ function implicitCached()
|
||||
|
||||
var entries = [
|
||||
// Explicit entries
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
|
||||
// Fallback entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false],
|
||||
|
||||
// Whitelist entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
|
||||
|
||||
// Implicit entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
|
||||
|
||||
// Dynamic entries
|
||||
["http://mochi.test:8888/tests/SimpleTest/EventUtils.js", true]
|
||||
["https://example.com/tests/SimpleTest/EventUtils.js", true]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(
|
||||
entries,
|
||||
function() {
|
||||
++gStep;
|
||||
|
||||
OfflineTest.setSJSState("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs", "second");
|
||||
OfflineTest.setSJSState("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs", "second");
|
||||
|
||||
applicationCache.update();
|
||||
// Invokes manifestUpdated()
|
||||
@ -201,13 +201,13 @@ function manifestUpdated()
|
||||
// Processing second version of the manifest.
|
||||
|
||||
// Whitelist entries
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", false);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", false);
|
||||
|
||||
// Fallback URI selection check
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
|
||||
|
||||
// Cache object status
|
||||
OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
|
||||
@ -215,29 +215,29 @@ function manifestUpdated()
|
||||
|
||||
var entries = [
|
||||
// Explicit entries
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
|
||||
// Fallback entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", true],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback2.html", true],
|
||||
|
||||
// Whitelist entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
|
||||
|
||||
// Implicit entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
|
||||
|
||||
// Dynamic entries
|
||||
["http://mochi.test:8888/tests/SimpleTest/EventUtils.js", true]
|
||||
["https://example.com/tests/SimpleTest/EventUtils.js", true]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(
|
||||
entries,
|
||||
function() {
|
||||
++gStep;
|
||||
|
||||
OfflineTest.setSJSState("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs", "third");
|
||||
OfflineTest.setSJSState("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs", "second");
|
||||
OfflineTest.setSJSState("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs", "third");
|
||||
OfflineTest.setSJSState("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs", "second");
|
||||
|
||||
gGotFrameVersion = 0;
|
||||
updatingFrame.location.reload();
|
||||
@ -250,13 +250,13 @@ function manifestUpdated()
|
||||
// Processing third version of the manifest.
|
||||
|
||||
// Whitelist entries
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", true);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", true);
|
||||
|
||||
// Fallback URI selection check
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
|
||||
"", false);
|
||||
checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
|
||||
checkFallbackAndWhitelisting("https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
|
||||
|
||||
// Cache object status
|
||||
OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
|
||||
@ -266,21 +266,21 @@ function manifestUpdated()
|
||||
|
||||
var entries = [
|
||||
// Explicit entries
|
||||
["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
["https://example.com/tests/SimpleTest/SimpleTest.js", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
|
||||
|
||||
// Fallback entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false],
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/fallback2.html", true],
|
||||
|
||||
// Whitelist entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
|
||||
|
||||
// Implicit entries
|
||||
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
|
||||
["https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
|
||||
|
||||
// Dynamic entries
|
||||
["http://mochi.test:8888/tests/SimpleTest/EventUtils.js", true]
|
||||
["https://example.com/tests/SimpleTest/EventUtils.js", true]
|
||||
];
|
||||
OfflineTest.checkCacheEntries(
|
||||
entries,
|
||||
@ -338,9 +338,9 @@ if (OfflineTest.setup()) {
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe name="updatingFrame" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs"></iframe>
|
||||
<iframe name="fallbackFrame1" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html"></iframe>
|
||||
<iframe name="fallbackFrame2" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html"></iframe>
|
||||
<iframe name="whitelistFrame" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html"></iframe>
|
||||
<iframe name="updatingFrame" src="https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs"></iframe>
|
||||
<iframe name="fallbackFrame1" src="https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html"></iframe>
|
||||
<iframe name="fallbackFrame2" src="https://example.com/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html"></iframe>
|
||||
<iframe name="whitelistFrame" src="https://example.com/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
||||
<head>
|
||||
<title>xhtml manifest test</title>
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
CACHE MANIFEST
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
|
||||
UNKNOWN-SECTION:
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg
|
||||
here can be anything the current implementaion
|
||||
is not able to parse at all and is just silently ignored
|
||||
|
||||
CACHE:
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
@ -1,4 +1,4 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
|
||||
<head>
|
||||
<title>Updating implicit</title>
|
||||
|
||||
|
@ -2,8 +2,8 @@ ver1manifest =
|
||||
"CACHE MANIFEST\n" +
|
||||
"# v1\n" +
|
||||
"\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs\n" +
|
||||
"\n" +
|
||||
"FALLBACK:\n" +
|
||||
"namespace1/ fallback.html\n" +
|
||||
@ -15,9 +15,9 @@ ver2manifest =
|
||||
"CACHE MANIFEST\n" +
|
||||
"# v2\n" +
|
||||
"\n" +
|
||||
"http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" +
|
||||
"https://example.com/tests/SimpleTest/SimpleTest.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" +
|
||||
"\n" +
|
||||
"FALLBACK:\n" +
|
||||
"namespace1/ fallback.html\n" +
|
||||
@ -27,8 +27,8 @@ ver3manifest =
|
||||
"CACHE MANIFEST\n" +
|
||||
"# v3\n" +
|
||||
"\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
|
||||
"https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" +
|
||||
"\n" +
|
||||
"FALLBACK:\n" +
|
||||
"namespace1/sub fallback2.html\n" +
|
||||
|
@ -1,7 +1,7 @@
|
||||
CACHE MANIFEST
|
||||
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
https://example.com/tests/SimpleTest/SimpleTest.js
|
||||
https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
NETWORK:
|
||||
*
|
||||
|
@ -184,7 +184,7 @@ MOCHITEST_CHROME_MANIFESTS += [
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
|
||||
BROWSER_CHROME_MANIFESTS += ['browser/browser.ini', 'mochitest/ajax/offline/browser.ini']
|
||||
|
||||
TEST_HARNESS_FILES.testing.mochitest.tests.dom.tests.mochitest.ajax.lib += [
|
||||
'mochitest/ajax/lib/AJAX_setup.js',
|
||||
|
@ -72,7 +72,7 @@ interface XULControllers;
|
||||
#ifdef HAVE_SIDEBAR
|
||||
[Replaceable, Throws] readonly attribute External external;
|
||||
#endif
|
||||
[Throws, Pref="browser.cache.offline.enable"] readonly attribute ApplicationCache applicationCache;
|
||||
[Throws, Pref="browser.cache.offline.enable", Func="nsGlobalWindowInner::OfflineCacheAllowedForContext"] readonly attribute ApplicationCache applicationCache;
|
||||
|
||||
// user prompts
|
||||
[Throws, NeedsSubjectPrincipal] void alert();
|
||||
|
@ -88,6 +88,15 @@ pref("browser.cache.frecency_half_life_hours", 6);
|
||||
pref("browser.cache.max_shutdown_io_lag", 2);
|
||||
|
||||
pref("browser.cache.offline.enable", true);
|
||||
|
||||
// Nightly and Early Beta will have AppCache disabled by default
|
||||
// Stable will remain enabled until Firefox 62.
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
pref("browser.cache.offline.insecure.enable", false);
|
||||
#else
|
||||
pref("browser.cache.offline.insecure.enable", true);
|
||||
#endif
|
||||
|
||||
// enable offline apps by default, disable prompt
|
||||
pref("offline-apps.allow_by_default", true);
|
||||
|
||||
|
@ -8682,6 +8682,12 @@ nsHttpChannel::MaybeWarnAboutAppCache()
|
||||
GetCallback(warner);
|
||||
if (warner) {
|
||||
warner->IssueWarning(nsIDocument::eAppCache, false);
|
||||
// When the page is insecure and the API is still enabled
|
||||
// provide an additional warning for developers of removal
|
||||
if (!IsHTTPS() &&
|
||||
Preferences::GetBool("browser.cache.offline.insecure.enable")) {
|
||||
warner->IssueWarning(nsIDocument::eAppCacheInsecure, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
[appcache-worker.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
||||
expected: TIMEOUT
|
||||
[Dedicated worker of the cached script]
|
||||
expected: FAIL
|
||||
|
@ -0,0 +1,2 @@
|
||||
[api_status_idle.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[api_status_uncached.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[api_swapcache_error.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[api_update.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -1,4 +1,5 @@
|
||||
[api_update_error.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
||||
[INVALID_STATE_ERR error test]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
[event_cached.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[event_checking.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[event_noupdate.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[event_progress.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -0,0 +1,2 @@
|
||||
[manifest_url_check.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
@ -1,4 +1,5 @@
|
||||
[window-security.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
||||
[A SecurityError exception must be thrown when window.oncancel is accessed from a different origin.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
[window-properties.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
||||
[Window attribute: oncancel]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
[009.html]
|
||||
prefs: [browser.cache.offline.insecure.enable:true]
|
||||
[document.open replacing singleton sessionStorage]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
[interfaces.html]
|
||||
prefs: [dom.forms.inputmode:true, dom.dialog_element.enabled:true, dom.forms.autocomplete.formautofill:true, dom.webcomponents.shadowdom.enabled:true, dom.moduleScripts.enabled:true]
|
||||
prefs: [dom.forms.inputmode:true, dom.dialog_element.enabled:true, dom.forms.autocomplete.formautofill:true, dom.webcomponents.shadowdom.enabled:true, dom.moduleScripts.enabled:true, browser.cache.offline.insecure.enable:true]
|
||||
[Document interface: attribute domain]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -53,6 +53,7 @@ using namespace mozilla::dom;
|
||||
|
||||
static nsOfflineCacheUpdateService *gOfflineCacheUpdateService = nullptr;
|
||||
static bool sAllowOfflineCache = true;
|
||||
static bool sAllowInsecureOfflineCache = true;
|
||||
|
||||
nsTHashtable<nsCStringHashKey>* nsOfflineCacheUpdateService::mAllowedDomains = nullptr;
|
||||
|
||||
@ -252,6 +253,9 @@ nsOfflineCacheUpdateService::nsOfflineCacheUpdateService()
|
||||
Preferences::AddBoolVarCache(&sAllowOfflineCache,
|
||||
"browser.cache.offline.enable",
|
||||
true);
|
||||
Preferences::AddBoolVarCache(&sAllowInsecureOfflineCache,
|
||||
"browser.cache.offline.insecure.enable",
|
||||
true);
|
||||
}
|
||||
|
||||
nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService()
|
||||
@ -633,6 +637,10 @@ OfflineAppPermForPrincipal(nsIPrincipal *aPrincipal,
|
||||
if (!match) {
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
if (!sAllowInsecureOfflineCache) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoCString domain;
|
||||
@ -704,6 +712,29 @@ nsOfflineCacheUpdateService::AllowOfflineApp(nsIPrincipal *aPrincipal)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!sAllowInsecureOfflineCache) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (!uri) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(uri);
|
||||
if (!innerURI) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
// if http then we should prevent this cache
|
||||
bool match;
|
||||
rv = innerURI->SchemeIs("http", &match);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (match) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GeckoProcessType_Default != XRE_GetProcessType()) {
|
||||
ContentChild* child = ContentChild::GetSingleton();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user