Auto merge of #5897 - Ms2ger:wpt_20150429, r=jdm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5897)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-04-29 17:18:36 -05:00
commit 037729fc4d
15 changed files with 302 additions and 131 deletions

View file

@ -25295,7 +25295,7 @@
}
]
},
"rev": "acdb8bf3e4714528b6b5f9ff038dc80ee4fb7dcf",
"rev": "fef3eb9bbb033d1d7150f4c70ecc1a5f59bcf115",
"url_base": "/",
"version": 2
}

View file

@ -0,0 +1,218 @@
[api-invalid-label.html]
type: testharness
[Invalid label "\\vunicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vunicode-1-1-utf-8\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " unicode-1-1-utf-8 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "unicode-1-1-utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-8\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-8 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf8\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf8 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf8" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-16be\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-16be " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16be" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-16\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-16 " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "\\vutf-16le\\v" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label " utf-16le " should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le" should be rejected by TextEncoder.]
expected: FAIL
[Invalid label "utf-16le" should be rejected by TextEncoder.]
expected: FAIL

View file

@ -1 +1 @@
56a7981c9c9c6df30fbb3add3d8d0085916fe313
7ee605db117bfc96ef145a1c77d43b704baeacb2

View file

@ -11,6 +11,9 @@
<script src=support.js></script>
<script>
// Transaction may fire window.onerror in some implementations.
setup({allow_uncaught_exception:true});
var db,
events = [],
t = async_test(document.title, {timeout: 10000})

View file

@ -13,6 +13,9 @@
<script src="support.js"></script>
<script>
// Transaction may fire window.onerror in some implementations.
setup({allow_uncaught_exception:true});
var db,
events = [],
t = async_test(document.title, {timeout: 10000})

View file

@ -2,13 +2,32 @@
<title>Encoding API: invalid label</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/encodings.js"></script>
<script>
var tests = ["invalid-invalidLabel"];
setup(function() {
encodings_table.forEach(function(section) {
section.encodings.filter(function(encoding) {
return encoding.name !== 'replacement';
}).forEach(function(encoding) {
encoding.labels.forEach(function(label) {
["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) {
tests.push(ws + label);
tests.push(label + ws);
tests.push(ws + label + ws);
});
});
});
});
});
var invalidLabel = "invalid-invalidLabel"
test(function() {
assert_throws(new RangeError(), function() { new TextEncoder(invalidLabel); });
assert_throws(new RangeError(), function() { new TextDecoder(invalidLabel); });
}, 'Invalid label "' + invalidLabel + '" should be rejected by API.');
tests.forEach(function(input) {
test(function() {
assert_throws(new RangeError(), function() { new TextEncoder(input); });
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextEncoder.');
test(function() {
assert_throws(new RangeError(), function() { new TextDecoder(input); });
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.');
});
</script>

View file

@ -22,12 +22,12 @@ cache_test(function(cache) {
cache_test(function(cache) {
return assert_promise_rejects(
cache.add('javascript://this-is-not-http-mmkay'),
'NetworkError',
'Cache.add should throw a NetworkError for non-HTTP/HTTPS URLs.');
new TypeError(),
'Cache.add should throw a TypeError for non-HTTP/HTTPS URLs.');
}, 'Cache.add called with non-HTTP/HTTPS URL');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
var request = new Request('../resources/simple.txt');
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
@ -36,28 +36,18 @@ cache_test(function(cache) {
}, 'Cache.add called with Request object');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return request.text()
.then(function() {
assert_false(request.bodyUsed);
})
.then(function() {
return cache.add(request);
});
}, 'Cache.add called with Request object with a used body');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
var request = new Request('../resources/simple.txt');
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
})
.then(function() {
return assert_promise_rejects(
cache.add(request),
new TypeError(),
'Cache.add should throw TypeError if same request is added twice.');
return cache.add(request);
})
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
});
}, 'Cache.add called twice with the same Request object');
@ -137,8 +127,8 @@ cache_test(function(cache) {
var request = new Request('../resources/simple.txt');
return assert_promise_rejects(
cache.addAll([request, request]),
new TypeError(),
'Cache.addAll should throw TypeError if the same request is added ' +
'InvalidStateError',
'Cache.addAll should throw InvalidStateError if the same request is added ' +
'twice.');
}, 'Cache.addAll called with the same Request object specified twice');

View file

@ -43,8 +43,8 @@ cache_test(function(cache) {
}, 'Cache.delete called with a string URL');
cache_test(function(cache) {
var request = new Request(test_url, { method: 'POST', body: 'Abc' });
return cache.put(request.clone(), new_test_response())
var request = new Request(test_url);
return cache.put(request, new_test_response())
.then(function() {
return cache.delete(request);
})
@ -52,33 +52,9 @@ cache_test(function(cache) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
assert_false(request.bodyUsed,
'Cache.delete should not consume request body.');
});
}, 'Cache.delete called with a Request object');
cache_test(function(cache) {
var request = new Request(test_url, { method: 'POST', body: 'Abc' });
return cache.put(request.clone(), new_test_response())
.then(function() {
return request.text();
})
.then(function() {
assert_true(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#body-mixin] ' +
'Request.bodyUsed should be true after text() method ' +
'resolves.');
})
.then(function() {
return cache.delete(request);
})
.then(function(result) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
});
}, 'Cache.delete with a Request object containing used body');
cache_test(function(cache) {
return cache.delete(test_url)
.then(function(result) {

View file

@ -181,32 +181,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with new Request');
cache_test(function(cache) {
var request = new Request('https://example.com/foo', {
method: 'POST',
body: 'Hello world!'
});
var response = new Response('Booyah!', {
status: 200,
headers: {'Content-Type': 'text/plain'}
});
return cache.put(request.clone(), response.clone())
.then(function() {
assert_false(
request.bodyUsed,
'[https://fetch.spec.whatwg.org/#concept-body-used-flag] ' +
'Request.bodyUsed flag should be initially false.');
})
.then(function() {
return cache.match(request);
})
.then(function(result) {
assert_false(request.bodyUsed,
'Cache.match should not consume Request body.');
});
}, 'Cache.match with Request containing non-empty body');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request,
{ignoreSearch: true})
@ -464,6 +438,15 @@ cache_test(function(cache) {
});
}, 'Cache.match invoked multiple times for the same Request/Response');
prepopulated_cache_test(simple_entries, function(cache, entries) {
var request = new Request(entries.a.request, { method: 'POST' });
return cache.match(request)
.then(function(result) {
assert_equals(result, undefined,
'Cache.match should not find a match');
});
}, 'Cache.match with POST Request');
// Helpers ---
// Run |test_function| with a Cache object as its only parameter. Prior to the

View file

@ -67,29 +67,6 @@ cache_test(function(cache) {
});
}, 'Cache.put with Response without a body');
cache_test(function(cache) {
var request = new Request(test_url, {
method: 'POST',
body: 'Hello'
});
var response = new Response(test_body);
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
return cache.put(request, response.clone())
.then(function() {
assert_true(request.bodyUsed,
'Cache.put should consume Request body.');
})
.then(function() {
return cache.match(request);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should store response body.');
});
}, 'Cache.put with Request containing a body');
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response(test_body);
@ -294,18 +271,11 @@ cache_test(function(cache) {
cache_test(function(cache) {
var request = new Request(test_url, {method: 'POST', body: test_body});
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
var copy = new Request(request);
assert_true(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-request] ' +
'Request constructor should set input\'s used flag.');
return assert_promise_rejects(
cache.put(request, new Response(test_body)),
new TypeError(),
'Cache.put should throw a TypeError for a request with used body.');
}, 'Cache.put with a used request body');
'Cache.put should throw a TypeError for a POST request.');
}, 'Cache.put with a POST request');
cache_test(function(cache) {
var response = new Response(test_body);

View file

@ -111,8 +111,11 @@ promise_test(function(test) {
return self.caches.match(transaction.request, {cacheName: 'foo'});
})
.then(function(response) {
assert_equals(response, undefined,
'The response should not be found.');
assert_unreached('The match with bad cache name should reject.');
})
.catch(function(err) {
assert_equals(err.name, 'NotFoundError',
'The match should reject with NotFoundError.');
return self.caches.has('foo');
})
.then(function(has_foo) {

View file

@ -106,6 +106,7 @@ promise_test(function(t) {
promise_test(function(t) {
var cache_name = 'cache-storage/open';
var url = '../resources/simple.txt';
var cache;
return self.caches.delete(cache_name)
.then(function() {
@ -115,21 +116,26 @@ promise_test(function(t) {
cache = result;
})
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
assert_equals(result, cache,
'CacheStorage.open should return the named Cache ' +
'object if it exists.');
return cache.add('../resources/simple.txt');
})
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
assert_equals(result, cache,
'CacheStorage.open should return the same ' +
'instance of an existing Cache object.');
});
assert_true(result instanceof Cache,
'CacheStorage.open should return a Cache object');
assert_not_equals(result, cache,
'CacheStorage.open should return a new Cache ' +
'object each time its called.');
return Promise.all([cache.keys(), result.keys()]);
})
.then(function(results) {
var expected_urls = results[0].map(function(r) { return r.url });
var actual_urls = results[1].map(function(r) { return r.url });
assert_array_equals(actual_urls, expected_urls,
'CacheStorage.open should return a new Cache ' +
'object for the same backing store.');
})
}, 'CacheStorage.open with existing cache');
promise_test(function(t) {

View file

@ -23,7 +23,7 @@ function wait_for_message(id) {
self.addEventListener('message', function listener(e) {
if (e.data.id === id) {
resolve(e.data);
self.removeEventListener(listener);
self.removeEventListener('message', listener);
}
});
});

View file

@ -30,7 +30,7 @@ interface EventInit {
interface Storage {
readonly attribute unsigned long length;
DOMString? key(unsigned long index);
getter DOMString getItem(DOMString key);
getter DOMString? getItem(DOMString key);
setter creator void setItem(DOMString key, DOMString value);
deleter void removeItem(DOMString key);
void clear();
@ -47,7 +47,7 @@ interface WindowLocalStorage {
Window implements WindowLocalStorage;
[Constructor(DOMString type, optional StorageEventInit eventInitDict)]
interface StorageEvent : Event {
readonly attribute DOMString key;
readonly attribute DOMString? key;
readonly attribute DOMString? oldValue;
readonly attribute DOMString? newValue;
readonly attribute DOMString url;
@ -55,7 +55,7 @@ interface StorageEvent : Event {
};
dictionary StorageEventInit : EventInit {
DOMString key;
DOMString? key;
DOMString? oldValue;
DOMString? newValue;
DOMString url;

View file

@ -2,9 +2,9 @@ onmessage = function(evt)
{
for (var i=0; true; i++)
{
if (i%1000 == 1)
if (i%1000 == 0)
{
postMessage(i);
}
}
}
}