WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
132890
Script worlds are hard to use correctly and easy to leak.
https://bugs.webkit.org/show_bug.cgi?id=132890
Summary
Script worlds are hard to use correctly and easy to leak.
Andreas Kling
Reported
2014-05-13 15:49:35 PDT
<
rdar://problem/16886955
>
Attachments
Patch
(1.88 KB, patch)
2014-05-13 16:16 PDT
,
Andreas Kling
no flags
Details
Formatted Diff
Diff
Patch II
(6.77 KB, patch)
2014-05-14 02:12 PDT
,
Andreas Kling
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2
(470.71 KB, application/zip)
2014-05-14 05:12 PDT
,
Build Bot
no flags
Details
Idea for EWS
(11.18 KB, patch)
2014-05-15 01:06 PDT
,
Andreas Kling
no flags
Details
Formatted Diff
Diff
Idea for EWS with crash fix
(11.55 KB, patch)
2014-05-15 16:00 PDT
,
Andreas Kling
no flags
Details
Formatted Diff
Diff
For my future self
(15.42 KB, patch)
2014-05-16 15:01 PDT
,
Andreas Kling
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Andreas Kling
Comment 1
2014-05-13 16:16:18 PDT
Created
attachment 231414
[details]
Patch
Geoffrey Garen
Comment 2
2014-05-13 16:58:32 PDT
Comment on
attachment 231414
[details]
Patch r=me I wonder if this should be built into WebCore::DOMWrapperWorld.
Andreas Kling
Comment 3
2014-05-14 02:12:52 PDT
Created
attachment 231437
[details]
Patch II InjectedBundleScriptWorld should only clearWrappers() for DOMWrapperWorlds that it "owns". The previous patch broke the case where the WTR bundle was using InjectedBundleScriptWorld to wrap already existing DOMWrapperWorlds.
Build Bot
Comment 4
2014-05-14 05:12:48 PDT
Comment on
attachment 231437
[details]
Patch II
Attachment 231437
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.appspot.com/results/5779318680584192
New failing tests: http/tests/security/isolatedWorld/window-setTimeout-string.html http/tests/security/isolatedWorld/dispatchEvent.html
Build Bot
Comment 5
2014-05-14 05:12:51 PDT
Created
attachment 231445
[details]
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-13 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Darin Adler
Comment 6
2014-05-14 09:23:09 PDT
Comment on
attachment 231437
[details]
Patch II View in context:
https://bugs.webkit.org/attachment.cgi?id=231437&action=review
Do you know why these two tests fail? http/tests/security/isolatedWorld/dispatchEvent.html [ Failure ] http/tests/security/isolatedWorld/window-setTimeout-string.html [ Failure ]
> Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp:83 > +void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef) > +{ > +}
Without any comment it’s not obvious why we are keeping this around. I presume the reason is specifically to keep old versions of Safari working, but perhaps there are other reasons? I don’t think that “once nobody uses them” is precise enough. We’d really like something here that could make it easy for a future contributor to be able to make the right decision about when to delete this.
Andreas Kling
Comment 7
2014-05-14 13:18:35 PDT
Comment on
attachment 231437
[details]
Patch II Ownership model isn't quite right here. This needs more work.
Andreas Kling
Comment 8
2014-05-15 01:06:52 PDT
Created
attachment 231495
[details]
Idea for EWS
Andreas Kling
Comment 9
2014-05-15 16:00:49 PDT
Created
attachment 231538
[details]
Idea for EWS with crash fix
WebKit Commit Bot
Comment 10
2014-05-15 16:02:29 PDT
Attachment 231538
[details]
did not pass style-queue: ERROR: Source/WebCore/bindings/js/ScriptController.cpp:98: One line control clauses should not use braces. [whitespace/braces] [4] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andreas Kling
Comment 11
2014-05-15 16:18:19 PDT
My plan here is to let DOMWrapperWorld directly own the JSDOMWindowShells. JSDOMWindowShell gets a DOMWrapperWorld& instead of a Ref<DOMWrapperWorld> since it's now strongly owned from the world. The main difference is that once a DOMWrapperWorld's refcount goes to zero, the JSDOMWindowShell will be up for GC. (Do note that JSEventListener refs the DOMWrapperWorld, for example.) Previously, DOMWrapperWorld would have a +1 ref from being in ScriptController's ShellMap. Calling clearWrappers() was the only way to bust out of that map before ScriptController destruction. With these changes, that's no longer necessary, just let your RefPtr<DOMWrapperWorld> go out of scope and it'll take care of the rest.
Andreas Kling
Comment 12
2014-05-15 16:20:19 PDT
I think it might also make sense to call this something like "ScriptWorld" instead of DOMWrapperWorld.
Andreas Kling
Comment 13
2014-05-16 15:01:58 PDT
Created
attachment 231595
[details]
For my future self I'm not going to work on this right now, so I'm uploading the patch as far as I got it.
Csaba Osztrogonác
Comment 14
2014-06-04 03:24:08 PDT
Comment on
attachment 231414
[details]
Patch Cleared Geoffrey Garen's review+ from obsolete
attachment 231414
[details]
so that this bug does not appear in
http://webkit.org/pending-commit
.
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