# HG changeset patch # User Henri Sivonen # Date 1305275595 -10800 # Node ID 1ed4788fc8c6b210b72a38c0b3e99f550fce2337 # Parent ecfea7698dee52dc1d7a40268dd63e8ef3f0a61b Test for bug 651441 - Make sure the HTML5 application cache selection algorithm runs properly when there is no manifest attribute. r=honzab.moz, NOT_REVIEWED. diff --git a/parser/htmlparser/tests/mochitest/Makefile.in b/parser/htmlparser/tests/mochitest/Makefile.in --- a/parser/htmlparser/tests/mochitest/Makefile.in +++ b/parser/htmlparser/tests/mochitest/Makefile.in @@ -82,16 +82,22 @@ _TEST_FILES = parser_datreader.js \ file_bug594730-7.html \ file_bug594730-8.html \ file_bug594730-9.html \ test_bug599584.html \ iframe_bug599584.html \ test_bug642908.html \ file_bug642908.sjs \ test_bug645115.html \ + test_651441.html \ + file_651441-1.html \ + file_651441-2.html \ + file_651441-script.js \ + file_651441.cacheManifest \ + file_651441.cacheManifest^headers^ \ $(NULL) # Disabled test due to orange on Linux # test_bug568470.html \ # file_bug568470.sjs \ # file_bug568470-script.sjs \ # Disable test due to frequent orange on Mac diff --git a/parser/htmlparser/tests/mochitest/file_651441-1.html b/parser/htmlparser/tests/mochitest/file_651441-1.html new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441-1.html @@ -0,0 +1,8 @@ + + +Manifest loader page + diff --git a/parser/htmlparser/tests/mochitest/file_651441-2.html b/parser/htmlparser/tests/mochitest/file_651441-2.html new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441-2.html @@ -0,0 +1,4 @@ + +This page and its script are supposed to come from the app cache + + diff --git a/parser/htmlparser/tests/mochitest/file_651441-script.js b/parser/htmlparser/tests/mochitest/file_651441-script.js new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441-script.js @@ -0,0 +1,1 @@ +opener.finish(); diff --git a/parser/htmlparser/tests/mochitest/file_651441.cacheManifest b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest @@ -0,0 +1,3 @@ +CACHE MANIFEST +file_651441-script.js +file_651441-2.html diff --git a/parser/htmlparser/tests/mochitest/file_651441.cacheManifest^headers^ b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest^headers^ new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/file_651441.cacheManifest^headers^ @@ -0,0 +1,2 @@ +Content-Type: text/cache-manifest + diff --git a/parser/htmlparser/tests/mochitest/test_651441.html b/parser/htmlparser/tests/mochitest/test_651441.html new file mode 100644 --- /dev/null +++ b/parser/htmlparser/tests/mochitest/test_651441.html @@ -0,0 +1,109 @@ + + + + + Test for Bug 651441 + + + + + +Mozilla Bug 651441 +

+ +
+
+
+ + diff --git a/testing/mochitest/specialpowers/content/specialpowers.js b/testing/mochitest/specialpowers/content/specialpowers.js --- a/testing/mochitest/specialpowers/content/specialpowers.js +++ b/testing/mochitest/specialpowers/content/specialpowers.js @@ -197,16 +197,56 @@ SpecialPowers.prototype = { this._getMUDV(window).textZoom = zoom; }, createSystemXHR: function() { return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] .createInstance(Ci.nsIXMLHttpRequest); }, + makeUri: function(url) { + return Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService) + .newURI(url, null, null); + }, + + addPermission: function(url, permission, allow) { + Cc["@mozilla.org/permissionmanager;1"] + .getService(Ci.nsIPermissionManager) + .add(this.makeUri(url), permission, allow ? + Ci.nsIPermissionManager.ALLOW_ACTION : + Ci.nsIPermissionManager.DENY_ACTION); + }, + + removePermission: function(url, permission) { + Cc["@mozilla.org/permissionmanager;1"] + .getService(Ci.nsIPermissionManager) + .remove(this.makeUri(url), permission); + }, + + setOfflineMode: function(mode) { + Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService) + .offline = mode; + }, + + getOfflineMode: function() { + return Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService) + .offline; + }, + + doomHTTPCacheEntry: function(url) { + Cc["@mozilla.org/network/cache-service;1"] + .getService(Ci.nsICacheService) + .createSession("HTTP", Ci.nsICache.STORE_ANYWHERE, Ci.nsICache.STREAM_BASED) + .openCacheEntry(url, Ci.nsICache.ACCESS_WRITE, false) + .doom(); + }, + gc: function() { this.DOMWindowUtils.garbageCollect(); } }; // Expose everything but internal APIs (starting with underscores) to // web content. SpecialPowers.prototype.__exposedProps__ = {};