WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
57516
Add ability to get frame from v8 context to chromium WebKit API
https://bugs.webkit.org/show_bug.cgi?id=57516
Summary
Add ability to get frame from v8 context to chromium WebKit API
Aaron Boodman
Reported
2011-03-30 17:50:11 PDT
Add ability to get frame from v8-wrapped DOMWindow to chromium WebKit API
Attachments
Patch
(2.92 KB, patch)
2011-03-30 17:50 PDT
,
Aaron Boodman
no flags
Details
Formatted Diff
Diff
Patch
(2.22 KB, patch)
2011-04-04 16:59 PDT
,
Aaron Boodman
no flags
Details
Formatted Diff
Diff
Patch
(2.22 KB, patch)
2011-04-04 17:28 PDT
,
Aaron Boodman
no flags
Details
Formatted Diff
Diff
Patch
(2.35 KB, patch)
2011-04-05 14:43 PDT
,
Aaron Boodman
no flags
Details
Formatted Diff
Diff
Patch
(8.34 KB, patch)
2011-04-05 16:33 PDT
,
Aaron Boodman
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Aaron Boodman
Comment 1
2011-03-30 17:50:59 PDT
Created
attachment 87647
[details]
Patch
Adam Barth
Comment 2
2011-03-30 17:55:20 PDT
Comment on
attachment 87647
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=87647&action=review
Also, there's no test. How will we know when we break this code?
> Source/WebKit/chromium/public/WebFrame.h:109 > + WEBKIT_API static WebFrame* getFrameForV8WrappedDOMWindow( > + v8::Handle<v8::Value>);
Can we pass in a v8::Context instead?
> Source/WebKit/chromium/src/WebFrameImpl.cpp:500 > + v8::Handle<v8::Object> windowObject = V8DOMWrapper::lookupDOMWrapper( > + V8DOMWindow::GetTemplate(), > + v8::Handle<v8::Object>::Cast(windowValue)); > + if (windowObject.IsEmpty()) > + return 0; > + > + DOMWindow* nativeWindow = V8DOMWindow::toNative(windowObject); > + ASSERT(nativeWindow); > + > + Frame* frame = nativeWindow->frame(); > + if (!frame || frame->domWindow() != nativeWindow) > + return 0; > + > + return WebFrameImpl::fromFrame(frame);
This logic should be in WebCore/bindings. If we change the internal structure of these objects, we shouldn't have to change the WebKit layer.
Aaron Boodman
Comment 3
2011-04-04 16:59:00 PDT
Created
attachment 88163
[details]
Patch V8 team added a way to get the context for an object, so this patch is very simple now. I tried adding a test using webkit_unit_tests, but v8 does not appear to work there. Please don't make me add layout tests. Please.
Adam Barth
Comment 4
2011-04-04 17:10:31 PDT
Comment on
attachment 88163
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=88163&action=review
This looks much better.
> Source/WebKit/chromium/public/WebFrame.h:107 > + // correspond to a frame (eg workers).
eg => e.g.,
Adam Barth
Comment 5
2011-04-04 17:11:15 PDT
+fishd for WebKit API review. (Notice how I cleverly passed the buck on deciding whether you need to include a test!)
Aaron Boodman
Comment 6
2011-04-04 17:28:59 PDT
Created
attachment 88171
[details]
Patch fix e.g.
Darin Fisher (:fishd, Google)
Comment 7
2011-04-05 14:09:53 PDT
Comment on
attachment 88171
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=88171&action=review
Can you extend WebFrameTest.cpp to exercise this method?
> Source/WebKit/chromium/public/WebFrame.h:108 > + WEBKIT_API static WebFrame* frameForV8Context(v8::Handle<v8::Context>);
hmm... i know why you called this frameForV8Context, but maybe it would be better to just name this frameForContext since the parameter type carries the V8 bit. also, this name better matches up with frameFor{Entered,Current}Context. perhaps you could put this new method above fromFrameOwnerElement so that it is grouped together with the other frameFor*Context methods?
Aaron Boodman
Comment 8
2011-04-05 14:43:03 PDT
Created
attachment 88310
[details]
Patch Good ideas, done. PTAL.
Aaron Boodman
Comment 9
2011-04-05 14:51:40 PDT
Comment on
attachment 88310
[details]
Patch I tried creating a unit test for this, but v8 segfaulted as soon as it was entered inside a test. I'm going to land this now, but separately dig into why the crash. I wasn't sure whether v8 was supposed to be usable inside the test environment or not.
Aaron Boodman
Comment 10
2011-04-05 16:33:18 PDT
Created
attachment 88334
[details]
Patch Added a test. Turns out JavaScript wasn't enabled :|
WebKit Commit Bot
Comment 11
2011-04-05 18:55:57 PDT
Comment on
attachment 88334
[details]
Patch Clearing flags on attachment: 88334 Committed
r83007
: <
http://trac.webkit.org/changeset/83007
>
WebKit Commit Bot
Comment 12
2011-04-05 18:56:03 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug