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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js
new file mode 100644
index 0000000000000000000000000000000000000000..545f13633979e16d4b0969b805796852e59b1eab
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function setupMessageHandler() {
+ window.onmessage = function(e) {
+ if (e.data.command === 'start-download') {
+ console.log("Start Download received for URL " + e.data.url);
+ var anchor = document.createElement('a');
+ anchor.href = e.data.url;
+ anchor.download = 'foo';
+ document.getElementById('container').appendChild(anchor);
+ anchor.click();
+ }
+ };
+}
+
+function setCookiesBasedOnURLFragment() {
+ var cookieValue = window.location.hash.substr(1);
+ var expiresOn = new Date();
+ expiresOn.setMonth(expiresOn.getMonth() + 1);
+ cookieValue += ";path=/";
+ cookieValue += ";expires=" + expiresOn.toUTCString();
+ document.cookie = cookieValue;
+ console.log("Setting cookie: " + cookieValue);
+}
+
+window.onload = function() {
+ setCookiesBasedOnURLFragment();
+ setupMessageHandler();
+}

Powered by Google App Engine
This is Rietveld 408576698