зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1204268
- 'appcache validate' command doesn't work when manifest is in outer directory r=miker
MozReview-Commit-ID: Dtl5prPOQTT --HG-- extra : rebase_source : e35884fe5877f96d8366f3d0023112be959c494b
This commit is contained in:
Родитель
294979dc32
Коммит
0d7fac1c23
|
@ -26,7 +26,9 @@ skip-if = !e10s
|
||||||
support-files =
|
support-files =
|
||||||
browser_cmd_appcache_valid_appcache.appcache
|
browser_cmd_appcache_valid_appcache.appcache
|
||||||
browser_cmd_appcache_valid_appcache.appcache^headers^
|
browser_cmd_appcache_valid_appcache.appcache^headers^
|
||||||
browser_cmd_appcache_valid_index.html
|
browser_cmd_appcache_valid_index_relative_manifest.html
|
||||||
|
browser_cmd_appcache_valid_index_root_relative_manifest.html
|
||||||
|
browser_cmd_appcache_valid_index_absolute_manifest.html
|
||||||
browser_cmd_appcache_valid_page1.html
|
browser_cmd_appcache_valid_page1.html
|
||||||
browser_cmd_appcache_valid_page2.html
|
browser_cmd_appcache_valid_page2.html
|
||||||
browser_cmd_appcache_valid_page3.html
|
browser_cmd_appcache_valid_page3.html
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
// Tests that the appcache commands works as they should
|
// Tests that the appcache commands works as they should
|
||||||
|
|
||||||
const TEST_URI = "https://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";
|
"commandline/test/" +
|
||||||
|
"browser_cmd_appcache_valid_index_relative_manifest.html";
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
return Task.spawn(spawnTest).then(finish, helpers.handleError);
|
return Task.spawn(spawnTest).then(finish, helpers.handleError);
|
||||||
|
@ -111,8 +112,8 @@ function* spawnTest() {
|
||||||
setup: "appcache validate " + TEST_URI,
|
setup: "appcache validate " + TEST_URI,
|
||||||
check: {
|
check: {
|
||||||
input: "appcache validate " + TEST_URI,
|
input: "appcache validate " + TEST_URI,
|
||||||
// appcache validate https://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html
|
// appcache validate http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index_relative_manifest.html
|
||||||
markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
||||||
status: "VALID",
|
status: "VALID",
|
||||||
args: {
|
args: {
|
||||||
uri: {
|
uri: {
|
||||||
|
@ -152,8 +153,8 @@ function* spawnTest() {
|
||||||
post: function (output, text) {
|
post: function (output, text) {
|
||||||
ok(!text.includes("index"), "index is not contained in output");
|
ok(!text.includes("index"), "index is not contained in output");
|
||||||
ok(!text.includes("page1"), "page1 is not contained in output");
|
ok(!text.includes("page1"), "page1 is not contained in output");
|
||||||
ok(!text.includes("page2"), "page1 is not contained in output");
|
ok(!text.includes("page2"), "page2 is not contained in output");
|
||||||
ok(!text.includes("page3"), "page1 is not contained in output");
|
ok(!text.includes("page3"), "page3 is not contained in output");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -161,8 +162,8 @@ function* spawnTest() {
|
||||||
setup: "appcache viewentry --key " + TEST_URI,
|
setup: "appcache viewentry --key " + TEST_URI,
|
||||||
check: {
|
check: {
|
||||||
input: "appcache viewentry --key " + TEST_URI,
|
input: "appcache viewentry --key " + TEST_URI,
|
||||||
// appcache viewentry --key https://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html
|
// appcache viewentry --key http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index_relative_manifest.html
|
||||||
markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
|
||||||
status: "VALID",
|
status: "VALID",
|
||||||
args: {}
|
args: {}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
browser_cmd_appcache_valid_index.html
|
browser_cmd_appcache_valid_index_relative_manifest.html
|
||||||
browser_cmd_appcache_valid_page1.html
|
browser_cmd_appcache_valid_page1.html
|
||||||
browser_cmd_appcache_valid_page2.html
|
browser_cmd_appcache_valid_page2.html
|
||||||
browser_cmd_appcache_valid_page3.html
|
browser_cmd_appcache_valid_page3.html
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html manifest="http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_appcache.appcache">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<head>
|
||||||
|
<body>
|
||||||
|
<h1>Example index.html</h1>
|
||||||
|
<a href="browser_cmd_appcache_valid_index_absolute_manifest.html">Home</a> |
|
||||||
|
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
||||||
|
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
||||||
|
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,7 +5,7 @@
|
||||||
<head>
|
<head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Example index.html</h1>
|
<h1>Example index.html</h1>
|
||||||
<a href="browser_cmd_appcache_valid_index.html">Home</a> |
|
<a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html manifest="/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_appcache.appcache">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<head>
|
||||||
|
<body>
|
||||||
|
<h1>Example index.html</h1>
|
||||||
|
<a href="browser_cmd_appcache_valid_index_root_relative_manifest.html">Home</a> |
|
||||||
|
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
||||||
|
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
||||||
|
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,7 +5,7 @@
|
||||||
<head>
|
<head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Example page1.html</h1>
|
<h1>Example page1.html</h1>
|
||||||
<a href="browser_cmd_appcache_valid_index.html">Home</a> |
|
<a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<head>
|
<head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Example page2.html</h1>
|
<h1>Example page2.html</h1>
|
||||||
<a href="browser_cmd_appcache_valid_index.html">Home</a> |
|
<a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<head>
|
<head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Example page3.html</h1>
|
<h1>Example page3.html</h1>
|
||||||
<a href="browser_cmd_appcache_valid_index.html">Home</a> |
|
<a href="browser_cmd_appcache_valid_index_relative_manifest.html">Home</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
<a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
<a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
|
||||||
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
<a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
|
||||||
|
|
|
@ -312,14 +312,16 @@ AppCacheUtils.prototype = {
|
||||||
let htmlNode = this.doc.querySelector("html[manifest]");
|
let htmlNode = this.doc.querySelector("html[manifest]");
|
||||||
if (htmlNode) {
|
if (htmlNode) {
|
||||||
let pageUri = this.doc.location ? this.doc.location.href : this.uri;
|
let pageUri = this.doc.location ? this.doc.location.href : this.uri;
|
||||||
let origin = pageUri.substr(0, pageUri.lastIndexOf("/") + 1);
|
|
||||||
let manifestURI = htmlNode.getAttribute("manifest");
|
let manifestURI = htmlNode.getAttribute("manifest");
|
||||||
|
|
||||||
if (manifestURI.startsWith("/")) {
|
let originRegExp = new RegExp(/([a-z]*:\/\/[^/]*\/)/);
|
||||||
manifestURI = manifestURI.substr(1);
|
if (originRegExp.test(manifestURI)) {
|
||||||
|
return manifestURI;
|
||||||
|
} else if (manifestURI.startsWith("/")) {
|
||||||
|
return pageUri.match(originRegExp)[0] + manifestURI.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return origin + manifestURI;
|
return pageUri.substring(0, pageUri.lastIndexOf("/") + 1) + manifestURI;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче