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

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed)

Created:
7 years, 8 months ago by johnjbarton
Modified:
7 years, 5 months ago
Base URL:
https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Visibility:
Public.

Description

Apply ScriptPreprocessor to Web page scripts only. Move ScriptPreprocessor from ScriptDebugServer to ScriptController. Evaluate preprocessor in isolatedWorld. Preprocess event listeners and <script> elements before entering V8. Preprocess eval source in V8 beforeCompile event. Add Debugger.getScriptCompilationTypeInfo() to extract the V8 compilation script info, to seperate eval scripts from e.g. devtools command line evaluations. Report exceptions in the ScriptPreprocessor compilation. Add new test-cases for these error paths. BUG=226293

Patch Set 1 #

Patch Set 2 : Rebase; Rename DebuggerScope -> SystemScope; fix v8 Handles; fix calls from module_system.cc #

Patch Set 3 : Try to fix similarity test #

Patch Set 4 : Do not preprocess scripts named #

Patch Set 5 : Rebase after /bindings directory move #

Patch Set 6 : Rebase, simplify #

Total comments: 4

Patch Set 7 : Re-implment based on review #

Total comments: 2

Patch Set 8 : Complete re-write #

Patch Set 9 : Use V8ScriptRunner::compileAndRunInternalScript #

Patch Set 10 : Oops, no JS-builts #

Total comments: 10

Patch Set 11 : Partial response to review #

Total comments: 1

Patch Set 12 : Preprocess in isolated world #

Patch Set 13 : self-review #

Patch Set 14 : rebase #

Patch Set 15 : rebase #

Patch Set 16 : rebase #

Total comments: 39

Patch Set 17 : respond to review #

Total comments: 21

Patch Set 18 : rebase, use new EmbedderWorldIdLimit, make tests independent of changes in *-tests.js #

Patch Set 19 : respond to review comment #29 #

Patch Set 20 : move clearScriptPreprocessor() to ScriptController::clearWindowShell #

Total comments: 22

Patch Set 21 : respond to haraken comment #35 #

Total comments: 8

Patch Set 22 : rebase, add comment, v8HandleScope, ifdef guards #

Patch Set 23 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+395 lines, -123 lines) Patch
M LayoutTests/inspector/debugger/debugger-script-preprocessor.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +44 lines, -11 lines 0 comments Download
M LayoutTests/inspector/debugger/debugger-script-preprocessor-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +24 lines, -6 lines 0 comments Download
M Source/bindings/bindings.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +2 lines, -0 lines 0 comments Download
M Source/bindings/v8/DOMWrapperWorld.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +6 lines, -1 line 0 comments Download
M Source/bindings/v8/DebuggerScript.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +43 lines, -0 lines 0 comments Download
M Source/bindings/v8/PageScriptDebugServer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +3 lines, -1 line 0 comments Download
M Source/bindings/v8/PageScriptDebugServer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +8 lines, -1 line 0 comments Download
M Source/bindings/v8/ScriptController.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +13 lines, -4 lines 0 comments Download
M Source/bindings/v8/ScriptController.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +42 lines, -2 lines 0 comments Download
M Source/bindings/v8/ScriptDebugServer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +3 lines, -11 lines 0 comments Download
M Source/bindings/v8/ScriptDebugServer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 5 chunks +6 lines, -84 lines 0 comments Download
A Source/bindings/v8/ScriptPreprocessor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +63 lines, -0 lines 0 comments Download
A Source/bindings/v8/ScriptPreprocessor.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +130 lines, -0 lines 0 comments Download
M Source/bindings/v8/V8LazyEventListener.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/inspector/PageDebuggerAgent.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +6 lines, -1 line 0 comments Download

Messages

Total messages: 43 (0 generated)
johnjbarton
Ready for review
7 years, 8 months ago (2013-04-04 18:03:21 UTC) #1
johnjbarton
Try 2
7 years, 8 months ago (2013-04-05 15:37:00 UTC) #2
johnjbarton
Greg Simon suggested haraken as a reviewer as well.
7 years, 7 months ago (2013-04-30 22:30:04 UTC) #3
pfeldman
I am not a fan of the complexity it introduces given that the only client ...
7 years, 7 months ago (2013-05-01 07:33:55 UTC) #4
johnjbarton
On 2013/05/01 07:33:55, pfeldman wrote: > I'd suggest narrowing it down to isSystemScope. Things like ...
7 years, 7 months ago (2013-05-01 15:45:53 UTC) #5
johnjbarton
PTAL, On 2013/05/01 07:33:55, pfeldman wrote: > I am not a fan of the complexity ...
7 years, 7 months ago (2013-05-03 22:38:43 UTC) #6
pfeldman
https://codereview.chromium.org/13575004/diff/24001/Source/bindings/v8/ScriptController.h File Source/bindings/v8/ScriptController.h (right): https://codereview.chromium.org/13575004/diff/24001/Source/bindings/v8/ScriptController.h#newcode99 Source/bindings/v8/ScriptController.h:99: // Evaluate Web-origin JavaScript in the main world. (Not ...
7 years, 6 months ago (2013-05-29 15:03:52 UTC) #7
johnjbarton
On 2013/05/29 15:03:52, pfeldman wrote: ... > > https://codereview.chromium.org/13575004/diff/24001/Source/core/dom/ScriptElement.cpp > File Source/core/dom/ScriptElement.cpp (right): > > ...
7 years, 6 months ago (2013-05-29 23:45:12 UTC) #8
abarth-chromium
https://codereview.chromium.org/13575004/diff/33002/Source/bindings/v8/ScriptController.cpp File Source/bindings/v8/ScriptController.cpp (right): https://codereview.chromium.org/13575004/diff/33002/Source/bindings/v8/ScriptController.cpp#newcode726 Source/bindings/v8/ScriptController.cpp:726: static const String preprocessorName = "$preprocessor.js"; This will create ...
7 years, 6 months ago (2013-06-04 06:50:23 UTC) #9
johnjbarton
Marja, please review my use of ScopedPersistent for two members of ScriptController::ScriptPreprocessor. (Of course any ...
7 years, 6 months ago (2013-06-04 18:41:22 UTC) #10
abarth-chromium
On 2013/06/04 18:41:22, johnjbarton wrote: > I don't know what to do here: what context ...
7 years, 6 months ago (2013-06-04 20:07:00 UTC) #11
johnjbarton
On 2013/06/04 20:07:00, abarth wrote: > On 2013/06/04 18:41:22, johnjbarton wrote: > > I don't ...
7 years, 6 months ago (2013-06-04 21:41:22 UTC) #12
abarth-chromium
On 2013/06/04 21:41:22, johnjbarton wrote: > On 2013/06/04 20:07:00, abarth wrote: > > On 2013/06/04 ...
7 years, 6 months ago (2013-06-04 21:57:02 UTC) #13
johnjbarton
On 2013/06/04 21:57:02, abarth wrote: > On 2013/06/04 21:41:22, johnjbarton wrote: > > On 2013/06/04 ...
7 years, 6 months ago (2013-06-04 22:29:53 UTC) #14
abarth-chromium
On 2013/06/04 22:29:53, johnjbarton wrote: > This CL is a refactoring of the existing preprocessor ...
7 years, 6 months ago (2013-06-04 23:02:10 UTC) #15
johnjbarton
On 2013/06/04 23:02:10, abarth wrote: > On 2013/06/04 22:29:53, johnjbarton wrote: > > This CL ...
7 years, 6 months ago (2013-06-05 00:01:35 UTC) #16
marja
(I'll review the ScopedPersistent usage once you've reached a consensus about the feature with abarth@.)
7 years, 6 months ago (2013-06-05 09:37:34 UTC) #17
abarth-chromium
https://codereview.chromium.org/13575004/diff/37001/Source/bindings/v8/ScriptController.cpp File Source/bindings/v8/ScriptController.cpp (right): https://codereview.chromium.org/13575004/diff/37001/Source/bindings/v8/ScriptController.cpp#newcode736 Source/bindings/v8/ScriptController.cpp:736: v8::Local<v8::Context> context = v8::Context::New(m_isolate); This CL is not lgtm. ...
7 years, 6 months ago (2013-06-07 20:13:45 UTC) #18
johnjbarton
On 2013/06/07 20:13:45, abarth wrote: > https://codereview.chromium.org/13575004/diff/37001/Source/bindings/v8/ScriptController.cpp > File Source/bindings/v8/ScriptController.cpp (right): > > https://codereview.chromium.org/13575004/diff/37001/Source/bindings/v8/ScriptController.cpp#newcode736 > ...
7 years, 6 months ago (2013-06-17 19:47:11 UTC) #19
johnjbarton
Documentation of the ScriptPreprocessor feature use, use-cases, and implementation: https://code.google.com/p/chromium/wiki/ScriptPreprocessor Feedback welcome.
7 years, 5 months ago (2013-06-27 16:38:02 UTC) #20
abarth-chromium
On 2013/06/27 16:38:02, johnjbarton wrote: > Feedback welcome. "The preprocessor runs in an isolated world ...
7 years, 5 months ago (2013-06-27 22:33:04 UTC) #21
johnjbarton
On 2013/06/27 22:33:04, abarth wrote: > On 2013/06/27 16:38:02, johnjbarton wrote: > > Feedback welcome. ...
7 years, 5 months ago (2013-06-27 23:02:00 UTC) #22
johnjbarton
Adam, As far as I am aware, I've addressed the major issues here. What else ...
7 years, 5 months ago (2013-07-08 16:38:07 UTC) #23
abarth-chromium
https://chromiumcodereview.appspot.com/13575004/diff/70001/Source/bindings/v8/PageScriptDebugServer.cpp File Source/bindings/v8/PageScriptDebugServer.cpp (right): https://chromiumcodereview.appspot.com/13575004/diff/70001/Source/bindings/v8/PageScriptDebugServer.cpp#newcode70 Source/bindings/v8/PageScriptDebugServer.cpp:70: if (frame) You can merge these two lines. https://chromiumcodereview.appspot.com/13575004/diff/70001/Source/bindings/v8/PageScriptDebugServer.cpp#newcode71 ...
7 years, 5 months ago (2013-07-08 23:57:08 UTC) #24
abarth-chromium
The biggest problem is that you've co-opted a random world ID. The rest of the ...
7 years, 5 months ago (2013-07-08 23:57:57 UTC) #25
abarth-chromium
One way to solve the co-opted world ID problem is to change the API to ...
7 years, 5 months ago (2013-07-09 17:34:37 UTC) #26
abarth-chromium
On 2013/07/09 17:34:37, abarth wrote: > One way to solve the co-opted world ID problem ...
7 years, 5 months ago (2013-07-09 17:43:56 UTC) #27
johnjbarton
Adam, please take another look, esp. at the ScriptPreprocessor in ScriptController.cpp. I think I understand ...
7 years, 5 months ago (2013-07-09 22:44:54 UTC) #28
abarth-chromium
I'm basically happy with this CL except for the isolated wold ID and memory leak ...
7 years, 5 months ago (2013-07-09 23:14:10 UTC) #29
johnjbarton
Adam, Please take another look; 2 issues you raised I could not resolve. https://chromiumcodereview.appspot.com/13575004/diff/81001/Source/bindings/v8/ScriptController.cpp File ...
7 years, 5 months ago (2013-07-10 23:24:22 UTC) #30
abarth-chromium
On 2013/07/10 23:24:22, johnjbarton wrote: > https://chromiumcodereview.appspot.com/13575004/diff/81001/Source/core/inspector/PageDebuggerAgent.cpp#newcode141 > Source/core/inspector/PageDebuggerAgent.cpp:141: > frame->script()->clearScriptPreprocessor(); > On 2013/07/09 23:14:10, ...
7 years, 5 months ago (2013-07-10 23:27:02 UTC) #31
johnjbarton
On 2013/07/10 23:27:02, abarth wrote: > On 2013/07/10 23:24:22, johnjbarton wrote: > > > https://chromiumcodereview.appspot.com/13575004/diff/81001/Source/core/inspector/PageDebuggerAgent.cpp#newcode141 ...
7 years, 5 months ago (2013-07-10 23:39:26 UTC) #32
abarth-chromium
Great! Would still like other folks to look at the CL or should I do ...
7 years, 5 months ago (2013-07-10 23:53:50 UTC) #33
haraken
I'll take a look in an hour.
7 years, 5 months ago (2013-07-11 00:00:19 UTC) #34
haraken
https://chromiumcodereview.appspot.com/13575004/diff/97001/Source/bindings/v8/PageScriptDebugServer.cpp File Source/bindings/v8/PageScriptDebugServer.cpp (right): https://chromiumcodereview.appspot.com/13575004/diff/97001/Source/bindings/v8/PageScriptDebugServer.cpp#newcode71 Source/bindings/v8/PageScriptDebugServer.cpp:71: return frame->page()->mainFrame()->script(); I'm curious about how this is different ...
7 years, 5 months ago (2013-07-11 01:13:59 UTC) #35
johnjbarton
Haraken, I've made changes to address your comments, please take another look. https://chromiumcodereview.appspot.com/13575004/diff/97001/Source/bindings/v8/PageScriptDebugServer.cpp File Source/bindings/v8/PageScriptDebugServer.cpp ...
7 years, 5 months ago (2013-07-11 19:14:42 UTC) #36
haraken
LGTM. Please wait for abarth's approval. https://chromiumcodereview.appspot.com/13575004/diff/102001/Source/bindings/v8/ScriptController.cpp File Source/bindings/v8/ScriptController.cpp (right): https://chromiumcodereview.appspot.com/13575004/diff/102001/Source/bindings/v8/ScriptController.cpp#newcode733 Source/bindings/v8/ScriptController.cpp:733: String ScriptController::preprocess(const String& ...
7 years, 5 months ago (2013-07-12 00:13:18 UTC) #37
abarth-chromium
LGTM Thanks for iterating on this CL. I'm sorry if the process was painful at ...
7 years, 5 months ago (2013-07-12 00:25:15 UTC) #38
johnjbarton
Adam or Haraken: I made three additional changes since your lgtm: 1) Restored a line ...
7 years, 5 months ago (2013-07-12 17:56:49 UTC) #39
abarth-chromium
Ok. I'm not sure I understand fully, but it seems fine either way.
7 years, 5 months ago (2013-07-12 18:00:26 UTC) #40
johnjbarton
On 2013/07/12 00:25:15, abarth wrote: > Thanks for iterating on this CL. I'm sorry if ...
7 years, 5 months ago (2013-07-12 18:29:06 UTC) #41
haraken
> 1) Restored a line I deleted in ScriptDebugServer.cpp > v8::HandleScope scope(m_isolate); > 2) Added ...
7 years, 5 months ago (2013-07-13 00:37:04 UTC) #42
johnjbarton
7 years, 5 months ago (2013-07-16 17:22:12 UTC) #43
On 2013/07/13 00:37:04, haraken wrote:
>
https://chromiumcodereview.appspot.com/13575004/diff/102001/Source/bindings/v...
> File Source/bindings/v8/ScriptPreprocessor.cpp (right):
> 
>
https://chromiumcodereview.appspot.com/13575004/diff/102001/Source/bindings/v...
> Source/bindings/v8/ScriptPreprocessor.cpp:59:
> controller->executeScriptInIsolatedWorld(ScriptPreprocessorIsolatedWorldId,
> sources, DOMWrapperWorld::mainWorldExtensionGroup, &scriptResults);
> 
> I think we should implement executeInternalScriptInIsolatedWorld() and use it
> here, since the script we're going to execute is an internal script (i.e. not
a
> user script from a web page).
> 
> > without 'Internal', skip the memory and stack-limitation checks
> 
> More importantly, the difference between internal scripts and user scripts is
> that user scripts have to clean up a couple of things (clear IDB transactions,
> flush mutation observers etc) when the execution is finished. We should do the
> clean-up for user scripts but shouldn't do the clean-up for internal scripts.
> 
> See here:
>
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...

I opened 
https://code.google.com/p/chromium/issues/detail?id=260490
to decide how to make this improvement.

I'm closing this issue because it cannot land, the base URL set at creation time
is from pre-blink WebKit repo.

Powered by Google App Engine
This is Rietveld 408576698