Skip to content

Commit

Permalink
[html] Restore utility method for query encoding
Browse files Browse the repository at this point in the history
The `poll_for_stash` function was relocated from `resolve-url.js` in
service of a test refactoring [1]. However, the following tests depend
on the presence of that function in that file:

- html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html
- html/infrastructure/urls/resolving-urls/query-encoding/windows-1251.html
- html/infrastructure/urls/resolving-urls/query-encoding/windows-1252.html

Restore the function to its original location and persist the copy.

[1] #11300
  • Loading branch information
jugglinmike authored and domenic committed Feb 6, 2019
1 parent de6f8fc commit 9830c5a
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ onload = function() {
return 'expected substring '+expected+' got '+got;
}

function poll_for_stash(test_obj, uuid, expected) {
var start = new Date();
var poll = test_obj.step_func(function () {
var xhr = new XMLHttpRequest();
xhr.open('GET', stash_take + uuid);
xhr.onload = test_obj.step_func(function(e) {
if (xhr.response == "") {
if (new Date() - start > 10000) {
// If we set the status to TIMEOUT here we avoid a race between the
// page and the test timing out
test_obj.force_timeout();
}
test_obj.step_timeout(poll, 200);
} else {
assert_equals(xhr.response, expected);
test_obj.done();
}
});
xhr.send();
})
test_obj.step_timeout(poll, 200);
}

// loading html (or actually svg to support <embed>)
function test_load_nested_browsing_context(tag, attr, spec_url) {
async_test(function() {
Expand Down

0 comments on commit 9830c5a

Please sign in to comment.