Title: [173142] trunk/Source/WebCore
Revision
173142
Author
[email protected]
Date
2014-08-30 16:19:32 -0700 (Sat, 30 Aug 2014)

Log Message

Convert string literals to character literals in makeString usage
https://bugs.webkit.org/show_bug.cgi?id=136394

Patch by Joseph Pecoraro <[email protected]> on 2014-08-30
Reviewed by Sam Weinig.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::evaluateInOverlay):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::setOriginalURLForDownloadRequest):
* loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::logWarning):
* page/ContentSecurityPolicy.cpp:
(WebCore::CSPDirectiveList::checkMediaTypeAndReportViolation):
(WebCore::ContentSecurityPolicy::reportUnsupportedDirective):
(WebCore::ContentSecurityPolicy::reportInvalidPathCharacter):
Also reorder some code to ensure single string creation.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173141 => 173142)


--- trunk/Source/WebCore/ChangeLog	2014-08-30 22:43:33 UTC (rev 173141)
+++ trunk/Source/WebCore/ChangeLog	2014-08-30 23:19:32 UTC (rev 173142)
@@ -1,3 +1,22 @@
+2014-08-30  Joseph Pecoraro  <[email protected]>
+
+        Convert string literals to character literals in makeString usage
+        https://bugs.webkit.org/show_bug.cgi?id=136394
+
+        Reviewed by Sam Weinig.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::evaluateInOverlay):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::setOriginalURLForDownloadRequest):
+        * loader/MixedContentChecker.cpp:
+        (WebCore::MixedContentChecker::logWarning):
+        * page/ContentSecurityPolicy.cpp:
+        (WebCore::CSPDirectiveList::checkMediaTypeAndReportViolation):
+        (WebCore::ContentSecurityPolicy::reportUnsupportedDirective):
+        (WebCore::ContentSecurityPolicy::reportInvalidPathCharacter):
+        Also reorder some code to ensure single string creation.
+
 2014-08-26  Maciej Stachowiak  <[email protected]>
 
         Use RetainPtr::autorelease in some places where it seems appropriate

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (173141 => 173142)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2014-08-30 22:43:33 UTC (rev 173141)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2014-08-30 23:19:32 UTC (rev 173142)
@@ -869,7 +869,7 @@
 {
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
-    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ')')));
 }
 
 void InspectorOverlay::evaluateInOverlay(const String& method, const String& argument)
@@ -877,7 +877,7 @@
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
     command->pushString(argument);
-    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ')')));
 }
 
 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<InspectorValue> argument)
@@ -885,7 +885,7 @@
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
     command->pushValue(argument);
-    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ')')));
 }
 
 void InspectorOverlay::freePage()

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (173141 => 173142)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2014-08-30 22:43:33 UTC (rev 173141)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2014-08-30 23:19:32 UTC (rev 173142)
@@ -2358,7 +2358,7 @@
         // FIXME: Using host-only URL is a very heavy-handed approach. We should attempt to provide the actual page where the download was initiated from, as a reminder to the user.
         String hostOnlyURLString;
         if (port)
-            hostOnlyURLString = makeString(originalURL.protocol(), "://", originalURL.host(), ":", String::number(port));
+            hostOnlyURLString = makeString(originalURL.protocol(), "://", originalURL.host(), ':', String::number(port));
         else
             hostOnlyURLString = makeString(originalURL.protocol(), "://", originalURL.host());
 

Modified: trunk/Source/WebCore/loader/MixedContentChecker.cpp (173141 => 173142)


--- trunk/Source/WebCore/loader/MixedContentChecker.cpp	2014-08-30 22:43:33 UTC (rev 173141)
+++ trunk/Source/WebCore/loader/MixedContentChecker.cpp	2014-08-30 23:19:32 UTC (rev 173142)
@@ -90,7 +90,7 @@
 
 void MixedContentChecker::logWarning(bool allowed, const String& action, const URL& target) const
 {
-    String message = makeString((allowed ? "" : "[blocked] "), "The page at ", m_frame.document()->url().stringCenterEllipsizedToLength(), " ", action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
+    String message = makeString((allowed ? String() : "[blocked] "), "The page at ", m_frame.document()->url().stringCenterEllipsizedToLength(), ' ', action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
     m_frame.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, message);
 }
 

Modified: trunk/Source/WebCore/page/ContentSecurityPolicy.cpp (173141 => 173142)


--- trunk/Source/WebCore/page/ContentSecurityPolicy.cpp	2014-08-30 22:43:33 UTC (rev 173141)
+++ trunk/Source/WebCore/page/ContentSecurityPolicy.cpp	2014-08-30 23:19:32 UTC (rev 173142)
@@ -929,7 +929,7 @@
     if (checkMediaType(directive, type, typeAttribute))
         return true;
 
-    String message = makeString(consoleMessage, "\'", directive->text(), "\'.");
+    String message = makeString(consoleMessage, '\'', directive->text(), "\'.");
     if (typeAttribute.isEmpty())
         message = message + " When enforcing the 'plugin-types' directive, the plugin's media type must be explicitly declared with a 'type' attribute on the containing element (e.g. '<object type=\"[TYPE GOES HERE]\" ...>').";
 
@@ -1682,13 +1682,15 @@
     DEPRECATED_DEFINE_STATIC_LOCAL(String, optionsMessage, (ASCIILiteral("The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.")));
     DEPRECATED_DEFINE_STATIC_LOCAL(String, policyURIMessage, (ASCIILiteral("The 'policy-uri' directive has been removed from the specification. Please specify a complete policy via the Content-Security-Policy header.")));
 
-    String message = makeString("Unrecognized Content-Security-Policy directive '", name, "'.\n");
+    String message;
     if (equalIgnoringCase(name, allow))
         message = allowMessage;
     else if (equalIgnoringCase(name, options))
         message = optionsMessage;
     else if (equalIgnoringCase(name, policyURI))
         message = policyURIMessage;
+    else
+        message = makeString("Unrecognized Content-Security-Policy directive '", name, "'.\n");
 
     logToConsole(message);
 }
@@ -1735,9 +1737,12 @@
 {
     ASSERT(invalidChar == '#' || invalidChar == '?');
 
-    String ignoring = "The fragment identifier, including the '#', will be ignored.";
+    String ignoring;
     if (invalidChar == '?')
         ignoring = "The query component, including the '?', will be ignored.";
+    else
+        ignoring = "The fragment identifier, including the '#', will be ignored.";
+
     String message = makeString("The source list for Content Security Policy directive '", directiveName, "' contains a source with an invalid path: '", value, "'. ", ignoring);
     logToConsole(message);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to