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

Side by Side Diff: chrome/test/data/extensions/api_test/sandboxed_pages_csp/main.js

Issue 2563843002: Restrict app sandbox's CSP to disallow loading web content in them. (Closed)
Patch Set: sync @tott Created 3 years, 11 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 var LOCAL_FILE_NAME = 'local_frame.html';
6 var REMOTE_FILE_NAME = 'remote_frame.html';
7
8 onmessage = function(e) {
9 chrome.test.assertEq(e.data, 'succeeded');
10 chrome.test.succeed();
11 };
12
13 var loadIframeContentInSandboxedPage = function(localUrl, remoteUrl) {
14 var sandboxedFrame = document.createElement('iframe');
15 sandboxedFrame.src = 'sandboxed.html';
16 sandboxedFrame.onload = function() {
17 sandboxedFrame.contentWindow.postMessage(
18 JSON.stringify(['load', localUrl, remoteUrl]), '*');
19 sandboxedFrame.onload = null;
20 };
21 document.body.appendChild(sandboxedFrame);
22 };
23
24 onload = function() {
25 chrome.test.getConfig(function(config) {
26 chrome.test.runTests([
27 // Local frame will succeed loading, but remote frame will fail.
28 function sandboxedFrameTestLocalAndRemote() {
29 var remoteUrl = 'http://localhost:' + config.testServer.port +
30 '/extensions/api_test/sandboxed_pages_csp/' + REMOTE_FILE_NAME;
31 loadIframeContentInSandboxedPage(
32 LOCAL_FILE_NAME, remoteUrl);
33 }
34 ]);
35 });
36 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698