Title: [148964] trunk/Source/WebCore
Revision
148964
Author
[email protected]
Date
2013-04-23 07:54:29 -0700 (Tue, 23 Apr 2013)

Log Message

XSSAuditor performance regression due to threaded parser changes.
<http://webkit.org/b/115037>
<rdar://problem/13716069>

Reviewed by Anders Carlsson.

>From Blink r148792 by <[email protected]>:

The refactoring we did for the threaded parser introduced a performance
regression in innerHTML because we'd boot up the XSSAuditor for fragment
parsing. This CL returns to our earlier behavior of not booting up the
XSSAuditor when parsing fragments.

* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::HTMLDocumentParser):
* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::initForFragment):
* html/parser/XSSAuditor.h:
(XSSAuditor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148963 => 148964)


--- trunk/Source/WebCore/ChangeLog	2013-04-23 14:45:52 UTC (rev 148963)
+++ trunk/Source/WebCore/ChangeLog	2013-04-23 14:54:29 UTC (rev 148964)
@@ -1,5 +1,27 @@
 2013-04-23  Andreas Kling  <[email protected]>
 
+        XSSAuditor performance regression due to threaded parser changes.
+        <http://webkit.org/b/115037>
+        <rdar://problem/13716069>
+
+        Reviewed by Anders Carlsson.
+
+        From Blink r148792 by <[email protected]>:
+
+        The refactoring we did for the threaded parser introduced a performance
+        regression in innerHTML because we'd boot up the XSSAuditor for fragment
+        parsing. This CL returns to our earlier behavior of not booting up the
+        XSSAuditor when parsing fragments.
+
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::HTMLDocumentParser):
+        * html/parser/XSSAuditor.cpp:
+        (WebCore::XSSAuditor::initForFragment):
+        * html/parser/XSSAuditor.h:
+        (XSSAuditor):
+
+2013-04-23  Andreas Kling  <[email protected]>
+
         Speed up ElementData::getAttributeItem(), which is hot.
         <http://webkit.org/b/115031>
 

Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (148963 => 148964)


--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2013-04-23 14:45:52 UTC (rev 148963)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2013-04-23 14:54:29 UTC (rev 148964)
@@ -118,6 +118,7 @@
     ASSERT(!shouldUseThreading());
     bool reportErrors = false; // For now document fragment parsing never reports errors.
     m_tokenizer->setState(tokenizerStateForContextElement(contextElement, reportErrors, m_options));
+    m_xssAuditor.initForFragment();
 }
 
 HTMLDocumentParser::~HTMLDocumentParser()

Modified: trunk/Source/WebCore/html/parser/XSSAuditor.cpp (148963 => 148964)


--- trunk/Source/WebCore/html/parser/XSSAuditor.cpp	2013-04-23 14:45:52 UTC (rev 148963)
+++ trunk/Source/WebCore/html/parser/XSSAuditor.cpp	2013-04-23 14:54:29 UTC (rev 148964)
@@ -227,6 +227,16 @@
     // we want to reference might not all have been constructed yet.
 }
 
+void XSSAuditor::initForFragment()
+{
+    ASSERT(isMainThread());
+    ASSERT(m_state == Uninitialized);
+    m_state = Initialized;
+    // When parsing a fragment, we don't enable the XSS auditor because it's
+    // too much overhead.
+    ASSERT(!m_isEnabled);
+}
+
 void XSSAuditor::init(Document* document, XSSAuditorDelegate* auditorDelegate)
 {
     const size_t miniumLengthForSuffixTree = 512; // FIXME: Tune this parameter.

Modified: trunk/Source/WebCore/html/parser/XSSAuditor.h (148963 => 148964)


--- trunk/Source/WebCore/html/parser/XSSAuditor.h	2013-04-23 14:45:52 UTC (rev 148963)
+++ trunk/Source/WebCore/html/parser/XSSAuditor.h	2013-04-23 14:54:29 UTC (rev 148964)
@@ -59,6 +59,8 @@
     XSSAuditor();
 
     void init(Document*, XSSAuditorDelegate*);
+    void initForFragment();
+
     PassOwnPtr<XSSInfo> filterToken(const FilterTokenRequest&);
     bool isSafeToSendToAnotherThread() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to