WebKit Bugzilla
Attachment 343168 Details for
Bug 186706
: ContentSecurityPolicySourceList wastes 51KB of Vector capacity on cnn.com
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186706-20180620112923.patch (text/plain), 4.19 KB, created by
Simon Fraser (smfr)
on 2018-06-20 11:29:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-06-20 11:29:24 PDT
Size:
4.19 KB
patch
obsolete
>Subversion Revision: 232900 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 80221903a52ef86da10e0ebb58161ee0f531f87d..fe61d98eaf7ded14e3c0cf584f2daeb1f959ca60 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-06-20 Simon Fraser <simon.fraser@apple.com> >+ >+ ContentSecurityPolicySourceList wastes 51KB of Vector capacity on cnn.com >+ https://bugs.webkit.org/show_bug.cgi?id=186706 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make ContentSecurityPolicySourceList::parse() call shrinkToFit() on m_list >+ after parsing to eliminate wasted vector capacity. >+ >+ Shrink ContentSecurityPolicySource down to 40 bytes by optimizing packing. >+ >+ * page/csp/ContentSecurityPolicySource.cpp: >+ (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): >+ * page/csp/ContentSecurityPolicySource.h: >+ * page/csp/ContentSecurityPolicySourceList.cpp: >+ (WebCore::ContentSecurityPolicySourceList::matches const): >+ (WebCore::ContentSecurityPolicySourceList::parse): >+ (WebCore::ContentSecurityPolicySourceList::matches): Deleted. >+ * page/csp/ContentSecurityPolicySourceList.h: >+ > 2018-06-15 Chris Dumez <cdumez@apple.com> > > StyleRuleMedia wastes 158KB of Vector capacity on cnn.com >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp b/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp >index 13a89630190a280268b96b99afe83e67cd6b741c..a8344ad66dbf1e2e2e30a22c8501ff098bb6f3f3 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp >@@ -37,8 +37,8 @@ ContentSecurityPolicySource::ContentSecurityPolicySource(const ContentSecurityPo > : m_policy(policy) > , m_scheme(scheme) > , m_host(host) >- , m_port(port) > , m_path(path) >+ , m_port(port) > , m_hostHasWildcard(hostHasWildcard) > , m_portHasWildcard(portHasWildcard) > { >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySource.h b/Source/WebCore/page/csp/ContentSecurityPolicySource.h >index 56cf0dc9e9f74bed1ad3a387760fe7ac669429c6..4eeabb01365251b6d89633ca9680d015f23106aa 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySource.h >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySource.h >@@ -53,8 +53,8 @@ private: > const ContentSecurityPolicy& m_policy; > String m_scheme; > String m_host; >- std::optional<uint16_t> m_port; > String m_path; >+ std::optional<uint16_t> m_port; > > bool m_hostHasWildcard; > bool m_portHasWildcard; >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp >index be6dc881f483d8d58da6feb98e142f3b5f53f611..40b5dd1de508c806053356b4f3e681b8ae024ddc 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp >@@ -130,7 +130,7 @@ bool ContentSecurityPolicySourceList::isProtocolAllowedByStar(const URL& url) co > return isAllowed; > } > >-bool ContentSecurityPolicySourceList::matches(const URL& url, bool didReceiveRedirectResponse) >+bool ContentSecurityPolicySourceList::matches(const URL& url, bool didReceiveRedirectResponse) const > { > if (m_allowStar && isProtocolAllowedByStar(url)) > return true; >@@ -196,6 +196,8 @@ void ContentSecurityPolicySourceList::parse(const UChar* begin, const UChar* end > > ASSERT(position == end || isASCIISpace(*position)); > } >+ >+ m_list.shrinkToFit(); > } > > // source = scheme ":" >diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h >index 04dc29c33f4cac10a9187902a2265a97a93858ae..9f63c3006a0ca7f2e33994801b542c36668c2e54 100644 >--- a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h >+++ b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h >@@ -44,7 +44,7 @@ public: > > void parse(const String&); > >- bool matches(const URL&, bool didReceiveRedirectResponse); >+ bool matches(const URL&, bool didReceiveRedirectResponse) const; > bool matches(const ContentSecurityPolicyHash&) const; > bool matches(const String& nonce) const; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186706
: 343168