Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js

Issue 1924473003: [Downloads] Use the initiating StoragePartition for resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function setupMessageHandler() {
6 window.onmessage = function(e) {
7 if (e.data.command === 'start-download') {
8 console.log("Start Download received for URL " + e.data.url);
9 var anchor = document.createElement('a');
10 anchor.href = e.data.url;
11 anchor.download = 'foo';
12 document.getElementById('container').appendChild(anchor);
13 anchor.click();
14 }
15 };
16 }
17
18 function setCookiesBasedOnURLFragment() {
19 var cookieValue = window.location.hash.substr(1);
20 cookieValue += ";path=/";
21 document.cookie = cookieValue;
22 console.log("Setting cookie: " + cookieValue);
23 }
24
25 window.onload = function() {
26 setCookiesBasedOnURLFragment();
27 setupMessageHandler();
28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698