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

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: Fix typo in comment 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 var expiresOn = new Date();
21 expiresOn.setMonth(expiresOn.getMonth() + 1);
22 cookieValue += ";path=/";
23 cookieValue += ";expires=" + expiresOn.toUTCString();
24 document.cookie = cookieValue;
25 console.log("Setting cookie: " + cookieValue);
26 }
27
28 window.onload = function() {
29 setCookiesBasedOnURLFragment();
30 setupMessageHandler();
31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698