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

Issue 2873283002: [Reland] Allow headless TabSocket in isolated worlds & remove obsolete logic (Closed)

Created:
3 years, 7 months ago by alex clarke (OOO till 29th)
Modified:
3 years, 7 months ago
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Allow headless TabSocket in isolated worlds & remove obsolete logic This patch only affects C++ Embedders of headless_lib and should have no effect on normal chrome even with the --headless flag. Recently we decided to no longer allow arbitrary mojo bindings, instead relying on the headless::TabSocket API for js<-->C++ communications. The public headless API for registering a mojo module has already been removed and this patch finishes the job by removing the code from MojoBindingsController which injected js mojo bindings for BINDINGS_POLICY_HEADLESS. In this patch we are replacing BINDINGS_POLICY_HEADLESS with BINDINGS_POLICY_HEADLESS_MAIN_WORLD and BINDINGS_POLICY_HEADLESS_ISOLATED_WORLD which provide access to the headless::TabSocket API to either the main world or for isolated worlds created by the Page.CreateIsolatedWorld DevTools command. For a security point of view this patch hopefully reduces the attack surface for the main world because js now only has access to the headless::TabSocket API rather than arbitrary mojo modules. Providing the headless::TabSocket API into isolated worlds is new but hopefully non-controversial. I note that ContentScripts have access to similar APIs for communication with the owning extension. I did investigate reusing that code but it didn't seem feasible. BUG=546953 Review-Url: https://codereview.chromium.org/2873283002 Cr-Original-Commit-Position: refs/heads/master@{#474238} Committed: https://chromium.googlesource.com/chromium/src/+/07ee7c399295b210c5338dfeb543f2d30f748340 Review-Url: https://codereview.chromium.org/2873283002 Cr-Commit-Position: refs/heads/master@{#474311} Committed: https://chromium.googlesource.com/chromium/src/+/1a4a3bab489e96546385236195be3d9b449a10e0

Patch Set 1 #

Patch Set 2 : Make main world and isolated world use the same injection method. Plus remove some obsolete stuff. #

Patch Set 3 : More tests #

Total comments: 22

Patch Set 4 : Responding to feedback #

Patch Set 5 : Forgot to save a file #

Patch Set 6 : Try and fix build with a dep #

Total comments: 8

Patch Set 7 : Changes for Sami #

Total comments: 4

Patch Set 8 : Moved the definitions into public/web #

Patch Set 9 : Used RequestExecuteV8Function #

Patch Set 10 : Simplify OnNextMessageFromEmbedder #

Patch Set 11 : Rebased #

Total comments: 2

Patch Set 12 : Moved the header to public/platform as requested #

Patch Set 13 : Fix MSVC nonsense #

Patch Set 14 : Fix GN Issue #

Unified diffs Side-by-side diffs Delta from patch set Stats (+455 lines, -128 lines) Patch
M content/public/common/bindings_policy.h View 1 2 3 4 1 chunk +6 lines, -4 lines 0 comments Download
M content/renderer/mojo_bindings_controller.h View 1 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/mojo_context_state.cc View 1 1 chunk +0 lines, -2 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -8 lines 0 comments Download
M headless/lib/browser/headless_browser_context_impl.cc View 1 2 chunks +0 lines, -17 lines 0 comments Download
M headless/lib/browser/headless_web_contents_impl.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M headless/lib/browser/headless_web_contents_impl.cc View 1 2 3 4 5 6 4 chunks +11 lines, -5 lines 0 comments Download
M headless/lib/headless_web_contents_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +231 lines, -7 lines 0 comments Download
M headless/lib/renderer/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M headless/lib/renderer/headless_content_renderer_client.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M headless/lib/renderer/headless_content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +142 lines, -65 lines 0 comments Download
M headless/public/headless_web_contents.h View 1 2 3 4 5 6 2 chunks +10 lines, -4 lines 0 comments Download
M headless/test/headless_browser_test.h View 1 2 3 1 chunk +6 lines, -2 lines 0 comments Download
M headless/test/headless_browser_test.cc View 1 2 3 3 chunks +9 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/public/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/public/platform/WebIsolatedWorldIds.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 77 (49 generated)
alex clarke (OOO till 29th)
Sami: PTAL Mike: Can you please take a look at this from a security POV ...
3 years, 7 months ago (2017-05-12 10:08:36 UTC) #7
alex clarke (OOO till 29th)
Jochen can you please review the content changes?
3 years, 7 months ago (2017-05-12 10:09:18 UTC) #9
Sami
https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h File content/public/common/bindings_policy.h (right): https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h#newcode35 content/public/common/bindings_policy.h:35: // Bindings that allows the JS content within a ...
3 years, 7 months ago (2017-05-12 17:18:02 UTC) #10
jochen (gone - plz use gerrit)
nit. the first line of the cl description needs to repeat the CL's title https://codereview.chromium.org/2873283002/diff/40001/headless/lib/renderer/headless_content_renderer_client.cc ...
3 years, 7 months ago (2017-05-15 05:41:56 UTC) #11
alex clarke (OOO till 29th)
PTAL https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h File content/public/common/bindings_policy.h (right): https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h#newcode35 content/public/common/bindings_policy.h:35: // Bindings that allows the JS content within ...
3 years, 7 months ago (2017-05-15 09:50:57 UTC) #12
Sami
https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h File content/public/common/bindings_policy.h (right): https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h#newcode40 content/public/common/bindings_policy.h:40: BINDINGS_POLICY_HEADLESS_ISOLATED_WORLD = 1 << 5, On 2017/05/15 09:50:57, alex ...
3 years, 7 months ago (2017-05-15 16:30:25 UTC) #23
alex clarke (OOO till 29th)
https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h File content/public/common/bindings_policy.h (right): https://codereview.chromium.org/2873283002/diff/40001/content/public/common/bindings_policy.h#newcode40 content/public/common/bindings_policy.h:40: BINDINGS_POLICY_HEADLESS_ISOLATED_WORLD = 1 << 5, On 2017/05/15 16:30:25, Sami ...
3 years, 7 months ago (2017-05-16 10:21:24 UTC) #24
Sami
> The bindings policy is sent from browser to renderer and it seems you're > ...
3 years, 7 months ago (2017-05-16 13:49:14 UTC) #25
alex clarke (OOO till 29th)
PTAL https://codereview.chromium.org/2873283002/diff/100001/headless/BUILD.gn File headless/BUILD.gn (right): https://codereview.chromium.org/2873283002/diff/100001/headless/BUILD.gn#newcode409 headless/BUILD.gn:409: "//third_party/WebKit/public:blink", On 2017/05/16 13:49:14, Sami wrote: > Did ...
3 years, 7 months ago (2017-05-17 09:09:32 UTC) #27
Sami
lgtm, although I'd appreciate if someone with more gin knowledge makes sure the bindings look ...
3 years, 7 months ago (2017-05-17 12:49:42 UTC) #31
alex clarke (OOO till 29th)
Jochen could you please take another look? Thanks!
3 years, 7 months ago (2017-05-18 07:28:59 UTC) #33
jochen (gone - plz use gerrit)
https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/headless_content_renderer_client.cc File headless/lib/renderer/headless_content_renderer_client.cc (right): https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/headless_content_renderer_client.cc#newcode122 headless/lib/renderer/headless_content_renderer_client.cc:122: context, context->Global(), arraysize(argv), argv); this should probably use WebLocalFrame::requestExecuteScriptInIsolatedWorld?
3 years, 7 months ago (2017-05-19 13:33:14 UTC) #34
jochen (gone - plz use gerrit)
also, is it possible to write tests for this?
3 years, 7 months ago (2017-05-19 13:33:29 UTC) #35
jochen (gone - plz use gerrit)
https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/devtools_isolated_world_ids.h File headless/lib/renderer/devtools_isolated_world_ids.h (right): https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/devtools_isolated_world_ids.h#newcode14 headless/lib/renderer/devtools_isolated_world_ids.h:14: }; why not put this file in public/web ? ...
3 years, 7 months ago (2017-05-19 13:34:05 UTC) #36
alex clarke (OOO till 29th)
On 2017/05/19 13:33:29, jochen wrote: > also, is it possible to write tests for this? ...
3 years, 7 months ago (2017-05-19 14:46:06 UTC) #37
alex clarke (OOO till 29th)
PTAL https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/devtools_isolated_world_ids.h File headless/lib/renderer/devtools_isolated_world_ids.h (right): https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/devtools_isolated_world_ids.h#newcode14 headless/lib/renderer/devtools_isolated_world_ids.h:14: }; On 2017/05/19 13:34:05, jochen wrote: > why ...
3 years, 7 months ago (2017-05-19 14:53:01 UTC) #40
jochen (gone - plz use gerrit)
On 2017/05/19 at 14:53:01, alexclarke wrote: > PTAL > > https://codereview.chromium.org/2873283002/diff/120001/headless/lib/renderer/devtools_isolated_world_ids.h > File headless/lib/renderer/devtools_isolated_world_ids.h (right): ...
3 years, 7 months ago (2017-05-22 12:04:22 UTC) #43
alex clarke (OOO till 29th)
On 2017/05/22 12:04:22, jochen wrote: > On 2017/05/19 at 14:53:01, alexclarke wrote: > > PTAL ...
3 years, 7 months ago (2017-05-23 08:16:28 UTC) #44
jochen (gone - plz use gerrit)
oh, nice lgtm with header moved to platform https://codereview.chromium.org/2873283002/diff/200001/third_party/WebKit/Source/platform/bindings/DEPS File third_party/WebKit/Source/platform/bindings/DEPS (right): https://codereview.chromium.org/2873283002/diff/200001/third_party/WebKit/Source/platform/bindings/DEPS#newcode3 third_party/WebKit/Source/platform/bindings/DEPS:3: "+public/web" ...
3 years, 7 months ago (2017-05-23 11:10:55 UTC) #51
Mike West
LGTM. I'm happy with the way this turned out.
3 years, 7 months ago (2017-05-23 13:35:48 UTC) #54
alex clarke (OOO till 29th)
Thanks all. https://codereview.chromium.org/2873283002/diff/200001/third_party/WebKit/Source/platform/bindings/DEPS File third_party/WebKit/Source/platform/bindings/DEPS (right): https://codereview.chromium.org/2873283002/diff/200001/third_party/WebKit/Source/platform/bindings/DEPS#newcode3 third_party/WebKit/Source/platform/bindings/DEPS:3: "+public/web" On 2017/05/23 11:10:55, jochen wrote: > ...
3 years, 7 months ago (2017-05-24 07:57:49 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2873283002/220001
3 years, 7 months ago (2017-05-24 07:58:35 UTC) #58
commit-bot: I haz the power
Committed patchset #12 (id:220001) as https://chromium.googlesource.com/chromium/src/+/07ee7c399295b210c5338dfeb543f2d30f748340
3 years, 7 months ago (2017-05-24 10:07:28 UTC) #61
vitaliii
A revert of this CL (patchset #12 id:220001) has been created in https://codereview.chromium.org/2902953003/ by vitaliii@chromium.org. ...
3 years, 7 months ago (2017-05-24 10:44:04 UTC) #62
findit-for-me
Findit (https://goo.gl/kROfz5) confirmed this CL at revision 474238 as the culprit for failures in the ...
3 years, 7 months ago (2017-05-24 11:14:08 UTC) #67
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2873283002/240001
3 years, 7 months ago (2017-05-24 12:19:19 UTC) #70
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2873283002/260001
3 years, 7 months ago (2017-05-24 14:19:21 UTC) #74
commit-bot: I haz the power
3 years, 7 months ago (2017-05-24 16:08:06 UTC) #77
Message was sent while issue was closed.
Committed patchset #14 (id:260001) as
https://chromium.googlesource.com/chromium/src/+/1a4a3bab489e96546385236195be...

Powered by Google App Engine
This is Rietveld 408576698