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

Side by Side Diff: chrome/test/data/webui/webview_execute_script_test.js

Issue 942533003: Enable <webview>.executeScript outside of Apps and Extensions [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_UserScriptSet_non_hostset_2
Patch Set: nits Created 5 years, 9 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | extensions/browser/api/execute_code_function.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 createWebview() {
6 var webview = document.createElement('webview');
7 document.body.appendChild(webview);
8 return webview;
9 }
10
11 function testExecuteScriptCode(url) {
12 var webview = createWebview();
13
14 var onGetBackgroundExecuted = function(results) {
15 chrome.send('testResult', [results.length == 1 && results[0] == 'red']);
16 };
17
18 var onSetBackgroundExecuted = function() {
19 webview.executeScript({
20 code: 'document.body.style.backgroundColor;'
21 }, onGetBackgroundExecuted);
22 };
23
24 var onLoadStop = function() {
25 webview.executeScript({
26 code: 'document.body.style.backgroundColor = \'red\';'
27 }, onSetBackgroundExecuted);
28 };
29
30 webview.addEventListener('loadstop', onLoadStop);
31 webview.src = url;
32 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | extensions/browser/api/execute_code_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698