Skip to content

Commit

Permalink
Expose URL fragment to request but not response.
Browse files Browse the repository at this point in the history
  • Loading branch information
chihweitung authored and jgraham committed Jan 3, 2017
1 parent 3fb0499 commit 07d1eb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions service-workers/service-worker/fetch-event.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,13 @@
.then(function(frame) {
assert_equals(
frame.contentDocument.body.textContent,
'Fragment Not Found',
'Service worker should not expose URL fragments.');
'Fragment Found :' + fragment,
'Service worker should expose URL fragments in request.');
frame.remove();
return service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
}, 'Service Worker must not expose FetchEvent URL fragments.');

async_test(function(t) {
var scope = 'resources/simple.html?cache';
var frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,19 @@ function handleUsedCheck(event) {
'bodyUsed: ' + lastResponseForUsedCheck.bodyUsed));
}
}

function handleFragmentCheck(event) {
var body;
if (event.request.url.indexOf('#') === -1) {
body = 'Fragment Not Found';
} else {
body = 'Fragment Found';
body = 'Fragment Found :' +
event.request.url.substring(event.request.url.indexOf('#'));
}
event.respondWith(new Response(body));
}

function handleCache(event) {
event.respondWith(new Response(event.request.cache));
}

function handleEventSource(event) {
if (event.request.mode === 'navigate') {
return;
Expand Down

0 comments on commit 07d1eb1

Please sign in to comment.