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

Issue 11968054: <webview>: Implement ExecuteScript (Closed)

Created:
7 years, 11 months ago by Fady Samuel
Modified:
7 years, 11 months ago
CC:
chromium-reviews, Aaron Boodman, darin-cc_chromium.org, chromium-apps-reviews_chromium.org
Visibility:
Public.

Description

<webview>: Implement ExecuteScript This patch implements executeScript for <webview> by using extensions bindings for forwarding requests to the browser process from the app process. The <webview> shim passes the ProcessId and the RouteID of the guest process to the ExecuteScriptFunction object in the browser process. From there, ExecuteScriptFunction grabs the guest web contents, and creates a ScriptExecutor object attached to the guest WebContents. The callback is supported trivially through the extension bindings. When a new guest web contents is created, we inject the Chrome App's extension information into the guest process, so that executeScript knows to bypass permission requests when attempting to execute script within the guest (as suggested by mpcomplete@). BUG=153530 Test=WebViewTest.Shim, webViewExecuteScript Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=178520

Patch Set 1 #

Patch Set 2 : Implement ExecuteScript #

Patch Set 3 : More cleanup #

Patch Set 4 : Added test #

Patch Set 5 : A little bit of clean + moving to webview directory #

Patch Set 6 : Use EXTENSION_FUNCTION_VALIDATE #

Patch Set 7 : Renamed misnamed variable #

Total comments: 18

Patch Set 8 : Addressed mpcomplete's comments #

Patch Set 9 : Updated stale browser_plugin_messages.h #

Total comments: 6

Patch Set 10 : Fixed nits #

Total comments: 4

Patch Set 11 : Fixed nits #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+294 lines, -8 lines) Patch
M chrome/browser/chrome_content_browser_client.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/chrome_content_browser_client.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +18 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/tabs/tabs_api.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -0 lines 0 comments Download
A chrome/browser/extensions/api/webview/webview_api.h View 1 2 3 4 5 6 7 8 9 1 chunk +31 lines, -0 lines 0 comments Download
A chrome/browser/extensions/api/webview/webview_api.cc View 1 2 3 4 5 6 7 1 chunk +88 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_function_histogram_value.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/script_executor.h View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/script_executor.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/chrome_browser_extensions.gypi View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/api.gyp View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
A chrome/common/extensions/api/webview.json View 1 2 3 4 5 6 7 8 9 1 chunk +72 lines, -0 lines 0 comments Download
M chrome/common/extensions/extension_messages.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/user_script_scheduler.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 1 comment Download
M chrome/renderer/resources/extensions/web_view.js View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/platform_apps/web_view/main.js View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
M content/browser/browser_plugin/browser_plugin_guest.cc View 1 2 3 4 5 6 7 3 chunks +5 lines, -0 lines 0 comments Download
M content/common/browser_plugin_messages.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -2 lines 0 comments Download
M content/public/browser/content_browser_client.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin.h View 1 2 3 4 5 6 7 2 chunks +6 lines, -2 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin.cc View 1 2 3 4 5 6 7 2 chunks +4 lines, -2 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin_bindings.cc View 1 2 3 4 5 6 7 4 chunks +23 lines, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
Fady Samuel
Hi Matt, Could you please take a look at the changes I've made in web_view.js, ...
7 years, 11 months ago (2013-01-21 18:08:28 UTC) #1
Fady Samuel
+lazyboy@ for browser_plugin changes.
7 years, 11 months ago (2013-01-23 01:16:55 UTC) #2
Matt Perry
General approach looks good. One concern is the amount of code duplication in ExecuteScript. I ...
7 years, 11 months ago (2013-01-23 02:50:49 UTC) #3
Fady Samuel
PTAL https://codereview.chromium.org/11968054/diff/13001/chrome/browser/chrome_content_browser_client.cc File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/11968054/diff/13001/chrome/browser/chrome_content_browser_client.cc#newcode879 chrome/browser/chrome_content_browser_client.cc:879: const Extension* extension = service->extensions()->GetByID(url.host()); On 2013/01/23 02:50:49, ...
7 years, 11 months ago (2013-01-23 20:12:03 UTC) #4
Matt Perry
lgtm https://codereview.chromium.org/11968054/diff/12034/chrome/browser/extensions/api/webview/webview_api.h File chrome/browser/extensions/api/webview/webview_api.h (right): https://codereview.chromium.org/11968054/diff/12034/chrome/browser/extensions/api/webview/webview_api.h#newcode13 chrome/browser/extensions/api/webview/webview_api.h:13: struct InjectDetails; Do you need this forward decl? ...
7 years, 11 months ago (2013-01-23 20:23:58 UTC) #5
lazyboy
browser_plugin changes LG. https://codereview.chromium.org/11968054/diff/12034/content/renderer/browser_plugin/browser_plugin_bindings.cc File content/renderer/browser_plugin/browser_plugin_bindings.cc (right): https://codereview.chromium.org/11968054/diff/12034/content/renderer/browser_plugin/browser_plugin_bindings.cc#newcode306 content/renderer/browser_plugin/browser_plugin_bindings.cc:306: // This should not be exposed ...
7 years, 11 months ago (2013-01-23 20:42:55 UTC) #6
Fady Samuel
Fixed nits. +jam@ for chrome/content API OWNER approval. https://codereview.chromium.org/11968054/diff/12034/chrome/browser/extensions/api/webview/webview_api.h File chrome/browser/extensions/api/webview/webview_api.h (right): https://codereview.chromium.org/11968054/diff/12034/chrome/browser/extensions/api/webview/webview_api.h#newcode13 chrome/browser/extensions/api/webview/webview_api.h:13: struct ...
7 years, 11 months ago (2013-01-23 20:54:32 UTC) #7
jam
content lgtm
7 years, 11 months ago (2013-01-23 22:16:03 UTC) #8
jam
https://codereview.chromium.org/11968054/diff/11021/content/common/browser_plugin_messages.h File content/common/browser_plugin_messages.h (right): https://codereview.chromium.org/11968054/diff/11021/content/common/browser_plugin_messages.h#newcode72 content/common/browser_plugin_messages.h:72: // Chrome's routing ID for the guest's RenderView. nit: ...
7 years, 11 months ago (2013-01-23 22:16:09 UTC) #9
Fady Samuel
Fixed nits. +cdn@ for browser_plugin_messages.h IPC audit. https://codereview.chromium.org/11968054/diff/11021/content/common/browser_plugin_messages.h File content/common/browser_plugin_messages.h (right): https://codereview.chromium.org/11968054/diff/11021/content/common/browser_plugin_messages.h#newcode72 content/common/browser_plugin_messages.h:72: // Chrome's ...
7 years, 11 months ago (2013-01-23 22:38:01 UTC) #10
Cris Neckar
IPC security audit LGTM
7 years, 11 months ago (2013-01-23 23:07:52 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/fsamuel@chromium.org/11968054/3019
7 years, 11 months ago (2013-01-23 23:51:39 UTC) #12
commit-bot: I haz the power
Retried try job too often on mac_rel for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_rel&number=92152
7 years, 11 months ago (2013-01-24 03:17:43 UTC) #13
not at google - send to devlin
and yes I am aware that that this patch has already been committed. https://codereview.chromium.org/11968054/diff/3019/chrome/renderer/extensions/user_script_scheduler.cc File ...
7 years, 11 months ago (2013-01-25 22:04:13 UTC) #14
Fady Samuel
7 years, 11 months ago (2013-01-25 22:06:09 UTC) #15
Message was sent while issue was closed.
On 2013/01/25 22:04:13, kalman wrote:
> and yes I am aware that that this patch has already been committed.
> 
>
https://codereview.chromium.org/11968054/diff/3019/chrome/renderer/extensions...
> File chrome/renderer/extensions/user_script_scheduler.cc (right):
> 
>
https://codereview.chromium.org/11968054/diff/3019/chrome/renderer/extensions...
> chrome/renderer/extensions/user_script_scheduler.cc:178: if
(!params.is_web_view
> &&
> I'm trying to understand the code here. Why no check for webview?

<webview> has unrestricted access to its guest. It doesn't need additional
permissions to access the guest.

Powered by Google App Engine
This is Rietveld 408576698