Summary: | Use child text content when determining whether to bail early in running a script | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Domenic Denicola <d> | ||||||
Component: | WebCore JavaScript | Assignee: | Rob Buis <rbuis> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cdumez, esprehn+autocc, ews-watchlist, kangil.han, rbuis, webkit-bug-importer, youennf, ysuzuki | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Safari Technology Preview | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Domenic Denicola
2018-02-12 08:51:34 PST
Created attachment 400052 [details]
Patch
Comment on attachment 400052 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=400052&action=review > Source/WebCore/dom/ScriptElement.cpp:184 > + const String& sourceText = scriptContent(); s/const String&/auto, scriptContent() is returning a String. If we need to optimise this a bit, maybe we should add a TextNodeTraversal::isEmpty routine so that we create the string only when executing the script. Created attachment 400193 [details]
Patch
Comment on attachment 400052 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=400052&action=review >> Source/WebCore/dom/ScriptElement.cpp:184 >> + const String& sourceText = scriptContent(); > > s/const String&/auto, scriptContent() is returning a String. > If we need to optimise this a bit, maybe we should add a TextNodeTraversal::isEmpty routine so that we create the string only when executing the script. Done. I think it is okay since the majority of the time the script should have non empty content. Also I checked chromium code and they also just get the contents and then test for empty. Committed r262125: <https://trac.webkit.org/changeset/262125> All reviewed patches have been landed. Closing bug and clearing flags on attachment 400193 [details]. |