mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1264993 - Unable to list/edit certain cookies in GCLI r=jwalker
Simple patch to correct errors in cookie host matching: 1. Match domains starting with a . in case this style was used e.g. .test.example.com 2. Match localhost URLS. MozReview-Commit-ID: 9qqnsNaW5oK --HG-- extra : transplant_source : %EF1o%A1u%97%9F%9D%99%97%DF%E0%C2D%09%E8%AFH%B7%1B
This commit is contained in:
parent
3c10e618d1
commit
bc2b9dd938
@ -34,6 +34,8 @@ support-files =
|
||||
support-files =
|
||||
browser_cmd_cookie.html
|
||||
[browser_cmd_cookie_host.js]
|
||||
support-files =
|
||||
browser_cmd_cookie.html
|
||||
[browser_cmd_csscoverage_oneshot.js]
|
||||
support-files =
|
||||
browser_cmd_csscoverage_page1.html
|
||||
|
@ -11,6 +11,7 @@
|
||||
<script type="text/javascript">
|
||||
document.cookie = "zap=zep";
|
||||
document.cookie = "zip=zop";
|
||||
document.cookie = "zig=zag; domain=.mochi.test";
|
||||
document.getElementById("result").innerHTML = document.cookie;
|
||||
</script>
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Tests that the cookie command works for host with a port specified
|
||||
|
||||
const TEST_URI = "http://mochi.test:8888/browser/devtools/client/commandline/"+
|
||||
const TEST_URI = "http://mochi.test:8888/browser/devtools/client/commandline/" +
|
||||
"test/browser_cmd_cookie.html";
|
||||
|
||||
function test() {
|
||||
@ -12,7 +14,7 @@ function test() {
|
||||
{
|
||||
setup: 'cookie list',
|
||||
exec: {
|
||||
output: [ /zap=zep/, /zip=zop/ ],
|
||||
output: [ /zap=zep/, /zip=zop/, /zig=zag/ ],
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -30,7 +32,7 @@ function test() {
|
||||
{
|
||||
setup: "cookie list",
|
||||
exec: {
|
||||
output: [ /zap=zep/, /zip=zop/, /zup=banana/, /Edit/ ]
|
||||
output: [ /zap=zep/, /zip=zop/, /zig=zag/, /zup=banana/, /Edit/ ]
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
@ -59,7 +59,10 @@ function isCookieAtHost(cookie, host) {
|
||||
return host == null;
|
||||
}
|
||||
if (cookie.host.startsWith(".")) {
|
||||
return host.endsWith(cookie.host);
|
||||
return ("." + host).endsWith(cookie.host);
|
||||
}
|
||||
if (cookie.host === "") {
|
||||
return host.startsWith("file://" + cookie.path);
|
||||
}
|
||||
return cookie.host == host;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user