mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1093611 - Add/modify tests making sure Link,URL,nsLocation::GetHash don't unescape characters r=smaug
This commit is contained in:
parent
95adf859fe
commit
a67bfd06a1
@ -6,6 +6,8 @@
|
||||
function navigate() {
|
||||
var arguments = window.location.hash.substring(1).split(",");
|
||||
var target = arguments[0];
|
||||
target = target.replace("%5B", "[");
|
||||
target = target.replace("%5D", "]");
|
||||
var mechanism = arguments[1];
|
||||
|
||||
switch(mechanism) {
|
||||
@ -29,6 +31,8 @@
|
||||
<script>
|
||||
var arguments = window.location.hash.substring(1).split(",");
|
||||
var target = arguments[0];
|
||||
target = target.replace("%5B", "[");
|
||||
target = target.replace("%5D", "]");
|
||||
var mechanism = arguments[1];
|
||||
document.write("target=" + target + " mechanism=" + mechanism);
|
||||
</script>
|
||||
|
@ -117,7 +117,7 @@
|
||||
{ url: 'http://example.com/carrot#question%3f',
|
||||
base: undefined,
|
||||
error: false,
|
||||
hash: '#question?'
|
||||
hash: '#question%3f'
|
||||
},
|
||||
{ url: 'https://example.com:4443?',
|
||||
base: undefined,
|
||||
@ -328,6 +328,7 @@
|
||||
ok(u.origin, 'http://mochi.test:8888', "The URL generated from a blob URI has an origin");
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
var blob = new Blob(['a']);
|
||||
var url = URL.createObjectURL(blob);
|
||||
|
@ -578,4 +578,5 @@ skip-if = buildapp == 'b2g' || e10s
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
|
||||
support-files = file_bug871161-1.html file_bug871161-2.html
|
||||
[test_bug1013316.html]
|
||||
[test_hash_encoded.html]
|
||||
|
||||
|
57
dom/html/test/test_hash_encoded.html
Normal file
57
dom/html/test/test_hash_encoded.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test link.hash attribute</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a id="target1" href="http://www.example.com/#q=♥"></a>
|
||||
<a id="target2" href="http://www.example.com/#q=â¥"></a>
|
||||
<a id="target3" href="http://www.example.com/#/search/%23important"></a>
|
||||
|
||||
<pre id="test">
|
||||
|
||||
<script>
|
||||
// Tests Link::GetHash
|
||||
|
||||
var target = document.getElementById("target1");
|
||||
is(target.hash, '#q=%E2%99%A5', 'Unexpected hash');
|
||||
|
||||
target = document.getElementById("target2");
|
||||
is(target.hash, '#q=%C3%A2%C2%A5', 'Unexpected hash');
|
||||
|
||||
target = document.getElementById("target3");
|
||||
is(target.hash, '#/search/%23important', 'Unexpected hash');
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// Tests URL::GetHash
|
||||
|
||||
var url = new URL("http://www.example.com/#q=♥")
|
||||
is(url.hash, '#q=%E2%99%A5', 'Unexpected hash');
|
||||
|
||||
url = new URL("http://www.example.com/#q=â¥")
|
||||
is(url.hash, '#q=%C3%A2%C2%A5', 'Unexpected hash');
|
||||
|
||||
url = new URL("http://www.example.com/#/search/%23important")
|
||||
is(url.hash, '#/search/%23important', 'Unexpected hash');
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// Tests nsLocation::GetHash
|
||||
|
||||
window.history.pushState(1, document.title, '#q=♥');
|
||||
is(location.hash,'#q=%E2%99%A5', 'Unexpected hash');
|
||||
|
||||
window.history.pushState(1, document.title, '#q=â¥');
|
||||
is(location.hash,'#q=%C3%A2%C2%A5', 'Unexpected hash');
|
||||
|
||||
window.history.pushState(1, document.title, '#/search/%23important');
|
||||
is(location.hash,'#/search/%23important', 'Unexpected hash');
|
||||
</script>
|
||||
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -111,7 +111,7 @@ onmessage = function() {
|
||||
{ url: 'http://example.com/carrot#question%3f',
|
||||
base: undefined,
|
||||
error: false,
|
||||
hash: '#question?'
|
||||
hash: '#question%3f'
|
||||
},
|
||||
{ url: 'https://example.com:4443?',
|
||||
base: undefined,
|
||||
|
Loading…
Reference in New Issue
Block a user