RESOLVED FIXED 40968
Make PendingScript hold a CachedResourceClient open for its lifetime
https://bugs.webkit.org/show_bug.cgi?id=40968
Summary Make PendingScript hold a CachedResourceClient open for its lifetime
Tony Gentilcore
Reported 2010-06-21 22:46:53 PDT
Make PendingScript hold a CachedResourceClient open for its lifetime
Attachments
Patch (14.21 KB, patch)
2010-06-21 22:53 PDT, Tony Gentilcore
no flags
Patch (14.21 KB, patch)
2010-06-22 08:30 PDT, Tony Gentilcore
no flags
Rollback (14.44 KB, patch)
2010-06-22 18:24 PDT, Tony Gentilcore
no flags
Patch (14.48 KB, patch)
2010-06-24 20:56 PDT, Tony Gentilcore
no flags
Patch for landing (14.48 KB, patch)
2010-06-24 21:04 PDT, Tony Gentilcore
no flags
Tony Gentilcore
Comment 1 2010-06-21 22:53:30 PDT
Eric Seidel (no email)
Comment 2 2010-06-21 22:56:42 PDT
Comment on attachment 59340 [details] Patch WebCore/html/HTML5ScriptRunner.h:31 + #include "CachedScript.h" Would be better to do this in the .cpp.
Eric Seidel (no email)
Comment 3 2010-06-21 23:10:58 PDT
Comment on attachment 59340 [details] Patch WebCore/html/HTML5ScriptRunner.cpp:57 + if (m_parsingBlockingScript.cachedScript() && m_parsingBlockingScript.watchingForLoad) I don't thin we should bother moving watchingForLoad() back to being a direct-access member. I suspect that PendingScript is only going to be moving more and more towards class-ness. I'm also not sure it maters. :) Move the implementation stuff into the cpp, and then I think this is good to go.
Tony Gentilcore
Comment 4 2010-06-22 08:30:29 PDT
Eric Seidel (no email)
Comment 5 2010-06-22 11:51:59 PDT
Comment on attachment 59370 [details] Patch LGTM! Note, no need for argument names when they don't add anything ( 78 void setCachedScript(CachedScript* cachedScript); ) No need to change it here though. We really need you to have commit-bit so nits are easier to fix on landing. :)
Tony Gentilcore
Comment 6 2010-06-22 11:53:52 PDT
(In reply to comment #5) > (From update of attachment 59370 [details]) > LGTM! Note, no need for argument names when they don't add anything ( 78 void setCachedScript(CachedScript* cachedScript); > ) I think this is the second time I've done that. So I'll put together a style-nit patch to fix those problems in WebCore/html/HTML5* > > No need to change it here though. We really need you to have commit-bit so nits are easier to fix on landing. :) Paperwork is in the mail :)
Adam Barth
Comment 7 2010-06-22 16:47:06 PDT
WebKit Review Bot
Comment 8 2010-06-22 17:36:03 PDT
Eric Seidel (no email)
Comment 9 2010-06-22 17:50:03 PDT
I think this caused 2 test cases to crash.
Tony Gentilcore
Comment 10 2010-06-22 18:24:35 PDT
Created attachment 59455 [details] Rollback
Tony Gentilcore
Comment 11 2010-06-22 18:26:29 PDT
Rollback tested by building and running http/tests/security/frame-loading-via-document-write.html on Windows.
Tony Gentilcore
Comment 12 2010-06-22 18:30:50 PDT
reopening for rollback
Eric Seidel (no email)
Comment 13 2010-06-22 18:36:08 PDT
Comment on attachment 59455 [details] Rollback ChangeLogs are append-only.
Eric Seidel (no email)
Comment 14 2010-06-22 18:41:57 PDT
Eric Seidel (no email)
Comment 15 2010-06-22 18:42:28 PDT
Rolled out in above commit.
Adam Barth
Comment 16 2010-06-23 02:23:26 PDT
Sorry Tony. I just renamed everything under the sun. :(
Mark Rowe (bdash)
Comment 17 2010-06-23 21:57:06 PDT
We happened to pick up r61638 in one of our internal builds before we noticed that it was rolled out. It was causing crashes in Safari too. I spent some time debugging and tracked it down to PendingScript’s lack of a copy constructor and assignment operator. The fact that HTMLScriptRunner::executePendingScript clears m_parsingBlockingScript by doing: m_parsingBlockingScript = PendingScript(); combined with the fact that PendingScript::setCachedScript unregisters / registers the PendingScript as a client of the CachedScript results in PendingScript instances sticking around as clients of CachedScripts even after they’re deleted, since they never have an opportunity to unregister themselves as a client. A trivial fix for that would be to add a clear method to PendingScript that uses setCachedScript(0) to clear the m_cachedScript member and just zeroes the other members, and then to adopt .clear() in place of the assignment operator above. Updating the class to inherit from Noncopyable will also avoid this mistake from being repeated. Hope that helps!
Adam Barth
Comment 18 2010-06-23 22:02:45 PDT
Thanks Mark. That's very helpful.
Tony Gentilcore
Comment 19 2010-06-24 20:56:09 PDT
WebKit Review Bot
Comment 20 2010-06-24 21:01:38 PDT
Attachment 59722 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 WebCore/ChangeLog:13: Line contains tab character. [whitespace/tab] [5] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Seidel (no email)
Comment 21 2010-06-24 21:02:04 PDT
Comment on attachment 59722 [details] Patch WebCore/ChangeLog:14 + No new tests because making a CachedResource purse itself is not purge LGTM.
Tony Gentilcore
Comment 22 2010-06-24 21:04:04 PDT
Created attachment 59725 [details] Patch for landing
Alexey Proskuryakov
Comment 23 2010-06-25 10:10:33 PDT
Is the crash also untestable, or only the original fix isn't? We really need better testing hooks for WebCore resource cache. It's such a large and important area of code, and almost untested! Can a layoutTestController method be added that would make this testable?
Tony Gentilcore
Comment 24 2010-06-25 10:44:12 PDT
(In reply to comment #23) > Is the crash also untestable, or only the original fix isn't? The crash showed up on two layout tests, so it is tested. This was landed without the CQ, the crashes showed up, and it was rolled back just a few revisions later. It was kind of a strange fluke that the nightly was cut in between the landing and the rollback. > > We really need better testing hooks for WebCore resource cache. It's such a large and important area of code, and almost untested! Totally agreed. It is scary. > > Can a layoutTestController method be added that would make this testable? Good idea. I think a method that purges all purgeable buffers would be perfect.
Eric Seidel (no email)
Comment 25 2010-06-25 11:27:39 PDT
(In reply to comment #24) > > Can a layoutTestController method be added that would make this testable? > > Good idea. I think a method that purges all purgeable buffers would be perfect. Woh, that would be useful! We should at least file a bug for that.
Tony Gentilcore
Comment 26 2010-06-25 11:32:24 PDT
(In reply to comment #25) > (In reply to comment #24) > > > Can a layoutTestController method be added that would make this testable? > > > > Good idea. I think a method that purges all purgeable buffers would be perfect. > > Woh, that would be useful! We should at least file a bug for that. https://bugs.webkit.org/show_bug.cgi?id=41219
WebKit Commit Bot
Comment 27 2010-06-25 22:27:49 PDT
Comment on attachment 59725 [details] Patch for landing Clearing flags on attachment: 59725 Committed r61940: <http://trac.webkit.org/changeset/61940>
WebKit Commit Bot
Comment 28 2010-06-25 22:27:56 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.