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

Issue 1897783002: [DO NOT COMMIT] CallWith=ScriptState with iframe

Created:
4 years, 8 months ago by yhirano
Modified:
4 years, 7 months ago
Reviewers:
haraken, shimazu, Yuki
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[DO NOT COMMIT] CallWith=ScriptState with iframe BUG=

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -3 lines) Patch
A + third_party/WebKit/LayoutTests/http/tests/fetch/referrer/resources/iframe.html View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/fetch/referrer/test.html View 1 chunk +29 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/core.gypi View 2 chunks +2 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/dom/TestObject.h View 1 chunk +28 lines, -0 lines 0 comments Download
A + third_party/WebKit/Source/core/dom/TestObject.idl View 1 chunk +4 lines, -3 lines 0 comments Download

Messages

Total messages: 11 (3 generated)
yhirano
See https://storage.googleapis.com/chromium-layout-test-archives/mac_chromium_rel_ng/212719/layout-test-results/http/tests/fetch/referrer/test-actual.txt. I expected this test passes.
4 years, 8 months ago (2016-04-18 08:54:57 UTC) #2
haraken
On 2016/04/18 08:54:57, yhirano wrote: > See > https://storage.googleapis.com/chromium-layout-test-archives/mac_chromium_rel_ng/212719/layout-test-results/http/tests/fetch/referrer/test-actual.txt. > I expected this test passes. ...
4 years, 8 months ago (2016-04-18 11:10:30 UTC) #3
yhirano1
On 2016/04/18 11:10:30, haraken wrote: > On 2016/04/18 08:54:57, yhirano wrote: > > See > ...
4 years, 8 months ago (2016-04-18 11:16:28 UTC) #4
haraken
On 2016/04/18 11:16:28, yhirano1 wrote: > On 2016/04/18 11:10:30, haraken wrote: > > On 2016/04/18 ...
4 years, 8 months ago (2016-04-18 13:11:42 UTC) #5
yhirano
On 2016/04/18 13:11:42, haraken wrote: > On 2016/04/18 11:16:28, yhirano1 wrote: > > On 2016/04/18 ...
4 years, 8 months ago (2016-04-20 03:38:30 UTC) #6
haraken
On 2016/04/20 03:38:30, yhirano wrote: > On 2016/04/18 13:11:42, haraken wrote: > > On 2016/04/18 ...
4 years, 8 months ago (2016-04-20 04:28:54 UTC) #7
yhirano
On 2016/04/20 04:28:54, haraken wrote: > On 2016/04/20 03:38:30, yhirano wrote: > > On 2016/04/18 ...
4 years, 7 months ago (2016-04-28 06:04:40 UTC) #10
haraken
4 years, 7 months ago (2016-04-28 14:44:50 UTC) #11
On 2016/04/28 06:04:40, yhirano wrote:
> On 2016/04/20 04:28:54, haraken wrote:
> > On 2016/04/20 03:38:30, yhirano wrote:
> > > On 2016/04/18 13:11:42, haraken wrote:
> > > > On 2016/04/18 11:16:28, yhirano1 wrote:
> > > > > On 2016/04/18 11:10:30, haraken wrote:
> > > > > > On 2016/04/18 08:54:57, yhirano wrote:
> > > > > > > See
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://storage.googleapis.com/chromium-layout-test-archives/mac_chromium_rel....
> > > > > > > I expected this test passes.
> > > > > > 
> > > > > > I think the existing behavior is correct.
> > > > > > 
> > > > > >   var obj = iframe.contentWindow.TestObject;
> > > > > >   obj.getScriptStateURL();
> > > > > > 
> > > > > 
> > > > > (Note: I'm creating a new TestObject instance in the test. I don't
know
> if
> > > it
> > > > > changes the conclusion)
> > > > > 
> > > > > 
> > > > > > should return the same result as:
> > > > > > 
> > > > > >   iframe.contentWindow.TestObject.getScriptStateURL();
> > > > > > 
> > > > > 
> > > > > > The latter should clearly return the URL of the iframe's context.
This
> > > means
> > > > > > that the former should return the URL of the iframe's context.
> > > > > 
> > > > > Can you explain this a bit?
> > > > 
> > > > (Disclaimer: I haven't yet verified my theory -- so the following
> > description
> > > > might be wrong.)
> > > > 
> > > > - When you create a new wrapper in x.bar(), the new wrapper is created
in
> > x's
> > > > creation context. When you create a new TestObject in
> > > > iframe.contentWindow.TestObject, the TestObject is created in the
iframe's
> > > > context.
> > > > 
> > > > - When you call x.foo() and V8 calls back fooMethodCallback in V8
binding,
> > > > isolate->GetCurrentContext is pointing to the context of x's creation
> > context.
> > > > When you call obj.getScriptStateURL(), the callback method runs with
> > > > isolate->GetCurrentContext pointing to the obj's creation context; i.e.,
> the
> > > > iframe's context. Then it returns a URL of the iframe's context.
> > > 
> > > v8::internal::Execution::Call[1] enters |function|'s context and hence we
> are
> > in
> > > |foo|'s creation context in your example, right?
> > > 
> > > 1:
> > >
> >
>
https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/execution.c...
> > 
> > Right, but the foo's creation context is the x's creation context; i.e., the
> > iframe's context.
> > 
> >   document.createElement !== iframe.contentWindow.document.createElement
> > 
> > These two functions are different things. The left-side one is the one
created
> > in the main frame's context. The right-side one is the one created in the
> > iframe's context.
> 
> Thank you.
> 
> That said, I want to expect that a ScriptState passed from
CallWith=ScriptState
> is always valid. Does it make sense to filter out such cases in the generated
> code, by
>  - Returning a rejected promise for promise-returning functions, and
>  - Returning undefined (or throwing an exception?) for other functions.

I think this is worth investigating. Currently we support script execution for a
detached iframe, but jochen@ and I are wondering if we really need to support
it. If we can just forbid executing scripts for a detached iframe, the problem
will be gone. (We need to investigate the spec and behaviors of other browsers.)

If we need to support it, one option would be to return a rejected promise or
undefined as you suggested, but here we need to investigate the spec and
behaviors of other browsers.

Powered by Google App Engine
This is Rietveld 408576698