WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
112734
Refactored script content removal in the fragment parser for clarity and speed
https://bugs.webkit.org/show_bug.cgi?id=112734
Summary
Refactored script content removal in the fragment parser for clarity and speed
Geoffrey Garen
Reported
2013-03-19 12:23:02 PDT
Refactored script content removal in the fragment parser for clarity and speed
Attachments
Patch
(79.82 KB, patch)
2013-03-19 13:47 PDT
,
Geoffrey Garen
enrica
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Geoffrey Garen
Comment 1
2013-03-19 13:47:55 PDT
Created
attachment 193913
[details]
Patch
WebKit Review Bot
Comment 2
2013-03-19 13:49:38 PDT
Attachment 193913
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/editing/pasteboard/paste-noscript-expected.txt', u'LayoutTests/editing/pasteboard/paste-noscript-svg-expected.txt', u'LayoutTests/editing/pasteboard/paste-noscript-xhtml-expected.txt', u'LayoutTests/editing/pasteboard/paste-noscript.html', u'LayoutTests/editing/pasteboard/paste-visible-script-expected.txt', u'LayoutTests/editing/pasteboard/resources/paste-noscript-content.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/WebCore.exp.in', u'Source/WebCore/dom/DocumentFragment.cpp', u'Source/WebCore/dom/DocumentFragment.h', u'Source/WebCore/dom/Element.cpp', u'Source/WebCore/dom/Element.h', u'Source/WebCore/dom/FragmentScriptingPermission.h', u'Source/WebCore/dom/ScriptableDocumentParser.cpp', u'Source/WebCore/dom/ScriptableDocumentParser.h', u'Source/WebCore/editing/markup.cpp', u'Source/WebCore/editing/markup.h', u'Source/WebCore/html/HTMLAnchorElement.cpp', u'Source/WebCore/html/HTMLBaseElement.cpp', u'Source/WebCore/html/HTMLElement.cpp', u'Source/WebCore/html/HTMLLinkElement.cpp', u'Source/WebCore/html/parser/HTMLConstructionSite.cpp', u'Source/WebCore/html/parser/HTMLConstructionSite.h', u'Source/WebCore/html/parser/HTMLDocumentParser.cpp', u'Source/WebCore/html/parser/HTMLDocumentParser.h', u'Source/WebCore/html/parser/HTMLTreeBuilder.cpp', u'Source/WebCore/html/parser/HTMLTreeBuilder.h', u'Source/WebCore/platform/blackberry/PasteboardBlackBerry.cpp', u'Source/WebCore/platform/chromium/DragDataChromium.cpp', u'Source/WebCore/platform/chromium/PasteboardChromium.cpp', u'Source/WebCore/platform/gtk/PasteboardGtk.cpp', u'Source/WebCore/platform/mac/PasteboardMac.mm', u'Source/WebCore/platform/qt/DragDataQt.cpp', u'Source/WebCore/platform/qt/PasteboardQt.cpp', u'Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp', u'Source/WebCore/platform/wx/PasteboardWx.cpp', u'Source/WebCore/svg/SVGAElement.cpp', u'Source/WebCore/svg/SVGAElement.h', u'Source/WebCore/xml/XMLErrors.cpp', u'Source/WebCore/xml/parser/XMLDocumentParser.cpp', u'Source/WebCore/xml/parser/XMLDocumentParser.h', u'Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp', u'Source/WebCore/xml/parser/XMLDocumentParserQt.cpp']" exit_code: 1 Source/WebCore/dom/FragmentScriptingPermission.h:28: #ifndef header guard has wrong style, please use: FragmentScriptingPermission_h [build/header_guard] [5] Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:708: nb_namespaces is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:734: nb_attributes is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 3 in 44 files If any of these errors are false positives, please file a bug against check-webkit-style.
Enrica Casucci
Comment 3
2013-03-19 14:14:01 PDT
Comment on
attachment 193913
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=193913&action=review
Looks good to me. This is a great improvement!
> Source/WebCore/dom/Element.cpp:-1034 > -void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, FragmentScriptingPermission scriptingPermission)
This is very clever!
> Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:-703 > -static inline void handleNamespaceAttributes(Vector<Attribute, 8>& prefixedAttributes, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec)
Why did you remove the 8?
Ryosuke Niwa
Comment 4
2013-03-19 14:32:31 PDT
Comment on
attachment 193913
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=193913&action=review
> Source/WebCore/dom/Element.cpp:1047 > + size_t dst = 0;
Please don't use abbreviations like dst.
> Source/WebCore/dom/Element.cpp:1048 > + for (size_t src = 0; src < attributeVector.size(); ++src) {
or src.
> Source/WebCore/dom/ScriptableDocumentParser.cpp:42 > + if (!pluginContentIsAllowed(m_parserContentPolicy) && (!document->settings() || document->settings()->unsafePluginPastingEnabled())) > + m_parserContentPolicy = allowPluginContent(m_parserContentPolicy);
Why are we not doing this in the caller?
Geoffrey Garen
Comment 5
2013-03-19 14:43:14 PDT
> Looks good to me. This is a great improvement!
Thanks! :)
> > Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:-703 > > -static inline void handleNamespaceAttributes(Vector<Attribute, 8>& prefixedAttributes, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec) > > Why did you remove the 8?
I wanted the HTML parser and the XML parser to use the same helper functions, and the HTML parser didn't have the 8. I could have change the HTML parser to include the 8, but I guessed that the HTML parser was the better thing to copy, since it gets more performance testing.
Geoffrey Garen
Comment 6
2013-03-19 14:45:32 PDT
> Please don't use abbreviations like dst. > or src.
Will fix.
> > + if (!pluginContentIsAllowed(m_parserContentPolicy) && (!document->settings() || document->settings()->unsafePluginPastingEnabled())) > > + m_parserContentPolicy = allowPluginContent(m_parserContentPolicy); > > Why are we not doing this in the caller?
We used to do this in the caller, but I worried it was error prone to make each caller do this check. I thought about this because I'm looking at adding another settings check, and I was especially worried about having to add that check to all the right call sites.
Build Bot
Comment 7
2013-03-19 14:51:55 PDT
Comment on
attachment 193913
[details]
Patch
Attachment 193913
[details]
did not pass win-ews (win): Output:
http://webkit-commit-queue.appspot.com/results/17135444
Geoffrey Garen
Comment 8
2013-03-19 14:54:00 PDT
Committed
r146264
: <
http://trac.webkit.org/changeset/146264
>
Ryosuke Niwa
Comment 9
2013-03-19 15:30:23 PDT
Windows build fix landed in
http://trac.webkit.org/changeset/146270
.
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