Title: [236703] trunk/Source/WebCore
Revision
236703
Author
achristen...@apple.com
Date
2018-10-01 17:21:14 -0700 (Mon, 01 Oct 2018)

Log Message

Don't read from WebCore's bundle for IDNScriptWhiteList
https://bugs.webkit.org/show_bug.cgi?id=190157

Reviewed by Dan Bernstein.

No change in behavior.  This increases performance by not reading from the WebCore bundle,
and it makes it so that URL-related functionality can be moved to a place without
a bundle for resources.

* Resources/IDNScriptWhiteList.txt: Removed.
* WebCore.xcodeproj/project.pbxproj:
* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::whiteListIDNScripts):
(WebCore::allCharactersInIDNScriptWhiteList):
(WebCore::readIDNScriptWhiteListFile): Deleted.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236702 => 236703)


--- trunk/Source/WebCore/ChangeLog	2018-10-02 00:16:54 UTC (rev 236702)
+++ trunk/Source/WebCore/ChangeLog	2018-10-02 00:21:14 UTC (rev 236703)
@@ -1,5 +1,23 @@
 2018-10-01  Alex Christensen  <achristen...@webkit.org>
 
+        Don't read from WebCore's bundle for IDNScriptWhiteList
+        https://bugs.webkit.org/show_bug.cgi?id=190157
+
+        Reviewed by Dan Bernstein.
+
+        No change in behavior.  This increases performance by not reading from the WebCore bundle,
+        and it makes it so that URL-related functionality can be moved to a place without
+        a bundle for resources.
+
+        * Resources/IDNScriptWhiteList.txt: Removed.
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mac/WebCoreNSURLExtras.mm:
+        (WebCore::whiteListIDNScripts):
+        (WebCore::allCharactersInIDNScriptWhiteList):
+        (WebCore::readIDNScriptWhiteListFile): Deleted.
+
+2018-10-01  Alex Christensen  <achristen...@webkit.org>
+
         Unreviewed, rolling out r236551.
 
         Fails URL validating too aggressively

Deleted: trunk/Source/WebCore/Resources/IDNScriptWhiteList.txt (236702 => 236703)


--- trunk/Source/WebCore/Resources/IDNScriptWhiteList.txt	2018-10-02 00:16:54 UTC (rev 236702)
+++ trunk/Source/WebCore/Resources/IDNScriptWhiteList.txt	2018-10-02 00:21:14 UTC (rev 236703)
@@ -1,23 +0,0 @@
-# Default Web Kit International Domain Name Script White List.
-
-Common
-Inherited
-
-Arabic
-Armenian
-Bopomofo
-Canadian_Aboriginal
-Devanagari
-Deseret
-Gujarati
-Gurmukhi
-Hangul
-Han
-Hebrew
-Hiragana
-Katakana_Or_Hiragana
-Katakana
-Latin
-Tamil
-Thai
-Yi

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (236702 => 236703)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-02 00:16:54 UTC (rev 236702)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-02 00:21:14 UTC (rev 236703)
@@ -2254,7 +2254,6 @@
 		7CC2DE031ECA04A50027B774 /* NotificationDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC2DE021ECA04A50027B774 /* NotificationDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */; };
 		7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
-		7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
 		7CC9722E1F93E3360004D4CF /* SettingsBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC660991F93057800D500E9 /* SettingsBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D531DD7B09300128552 /* SVGLengthValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
@@ -9682,7 +9681,6 @@
 		7CC6609B1F93057900D500E9 /* SettingsBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsBase.cpp; sourceTree = "<group>"; };
 		7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
 		7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = "<group>"; };
-		7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
 		7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMCallbackMicrotask.cpp; sourceTree = "<group>"; };
 		7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = "<group>"; };
 		7CD0E2B51F80A4820016A4CE /* AbortController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AbortController.h; sourceTree = "<group>"; };
@@ -15766,7 +15764,6 @@
 				65998A650E5F5FD3004E097A /* images */,
 				A1AA9AB81D23911500FEADB3 /* ContentFilterBlockedPage.html */,
 				A11E8C001B1E28BE0003A7C7 /* copyCursor.png */,
-				7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */,
 				2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */,
 				BCAD1808131C7A0D00990406 /* Localizable.strings */,
 				837A80111E1E127300026B9F /* Localizable.stringsdict */,
@@ -31379,7 +31376,6 @@
 				2D50A4B81CE10E0000198049 /* attachmentplacehol...@2x.png in Resources */,
 				A1AA9AB91D23911500FEADB3 /* ContentFilterBlockedPage.html in Resources */,
 				A11E8C051B1E28F40003A7C7 /* copyCursor.png in Resources */,
-				7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */,
 				2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */,
 				E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */,
 				E516699120FF9918009D2C27 /* listbuttonar...@2x.png in Resources */,

Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (236702 => 236703)


--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2018-10-02 00:16:54 UTC (rev 236702)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2018-10-02 00:21:14 UTC (rev 236703)
@@ -247,6 +247,16 @@
     }
 }
 
+static void whiteListIDNScript(const char* scriptName)
+{
+    int32_t script = u_getPropertyValueEnum(UCHAR_SCRIPT, scriptName);
+    if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
+        size_t index = script / 32;
+        uint32_t mask = 1 << (script % 32);
+        IDNScriptWhiteList[index] |= mask;
+    }
+}
+
 static BOOL readIDNScriptWhiteListFile(NSString *filename)
 {
     if (!filename)
@@ -271,12 +281,7 @@
         
         if (result == 1) {
             // Got a word, map to script code and put it into the array.
-            int32_t script = u_getPropertyValueEnum(UCHAR_SCRIPT, word);
-            if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
-                size_t index = script / 32;
-                uint32_t mask = 1 << (script % 32);
-                IDNScriptWhiteList[index] |= mask;
-            }
+            whiteListIDNScript(word);
         }
     }
     fclose(file);
@@ -294,12 +299,30 @@
             if (readIDNScriptWhiteListFile([[dirs objectAtIndex:i] stringByAppendingPathComponent:@"IDNScriptWhiteList.txt"]))
                 return;
         }
-
-        // Fall back on white list inside bundle.
-        NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebCore"];
-
-        if (!readIDNScriptWhiteListFile([bundle pathForResource:@"IDNScriptWhiteList" ofType:@"txt"]))
-            CRASH();
+        const char* defaultIDNScriptWhiteList[20] = {
+            "Common",
+            "Inherited",
+            "Arabic",
+            "Armenian",
+            "Bopomofo",
+            "Canadian_Aboriginal",
+            "Devanagari",
+            "Deseret",
+            "Gujarati",
+            "Gurmukhi",
+            "Hangul",
+            "Han",
+            "Hebrew",
+            "Hiragana",
+            "Katakana_Or_Hiragana",
+            "Katakana",
+            "Latin",
+            "Tamil",
+            "Thai",
+            "Yi",
+        };
+        for (const char* scriptName : defaultIDNScriptWhiteList)
+            whiteListIDNScript(scriptName);
     });
     
     int32_t i = 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to