| 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..6e150369a82b79863873c303e4fddd9cd2ca64e5
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js
|
| @@ -0,0 +1,28 @@
|
| +// 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);
|
| + cookieValue += ";path=/";
|
| + document.cookie = cookieValue;
|
| + console.log("Setting cookie: " + cookieValue);
|
| +}
|
| +
|
| +window.onload = function() {
|
| + setCookiesBasedOnURLFragment();
|
| + setupMessageHandler();
|
| +}
|
|
|