Title: [264423] trunk/Source
Revision
264423
Author
[email protected]
Date
2020-07-15 14:33:28 -0700 (Wed, 15 Jul 2020)

Log Message

Remove a few more uses of the terms black/white list
https://bugs.webkit.org/show_bug.cgi?id=214371

Reviewed by Alex Christensen.

Source/WebKit:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::shouldPlugInAutoStartFromOrigin): Reworded a comment.

Source/WebKitLegacy/mac:

* WebView/WebViewPrivate.h: Corrected a mistake in a comment.

Source/WTF:

* wtf/URLHelpers.cpp:
(WTF::URLHelpers::loadIDNAllowedScriptList): Renamed.
(WTF::URLHelpers::isLookalikeCharacter): Renamed.
(WTF::URLHelpers::addScriptToIDNAllowedScriptList): Renamed.
(WTF::URLHelpers::initializeDefaultIDNAllowedScriptList): Renamed.
(WTF::URLHelpers::allCharactersInAllowedIDNScriptList): Renamed.
(WTF::URLHelpers::mapHostName): Updated for name changes.
* wtf/URLHelpers.h: Renamed things.

* wtf/cocoa/NSURLExtras.mm:
(WTF::readIDNAllowedScriptListFile): Renamed.
(WTF::URLHelpers::loadIDNAllowedScriptList): Renamed. Also use a modern for
loop to simplify the code.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (264422 => 264423)


--- trunk/Source/WTF/ChangeLog	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WTF/ChangeLog	2020-07-15 21:33:28 UTC (rev 264423)
@@ -1,3 +1,24 @@
+2020-07-15  Darin Adler  <[email protected]>
+
+        Remove a few more uses of the terms black/white list
+        https://bugs.webkit.org/show_bug.cgi?id=214371
+
+        Reviewed by Alex Christensen.
+
+        * wtf/URLHelpers.cpp:
+        (WTF::URLHelpers::loadIDNAllowedScriptList): Renamed.
+        (WTF::URLHelpers::isLookalikeCharacter): Renamed.
+        (WTF::URLHelpers::addScriptToIDNAllowedScriptList): Renamed.
+        (WTF::URLHelpers::initializeDefaultIDNAllowedScriptList): Renamed.
+        (WTF::URLHelpers::allCharactersInAllowedIDNScriptList): Renamed.
+        (WTF::URLHelpers::mapHostName): Updated for name changes.
+        * wtf/URLHelpers.h: Renamed things.
+
+        * wtf/cocoa/NSURLExtras.mm:
+        (WTF::readIDNAllowedScriptListFile): Renamed.
+        (WTF::URLHelpers::loadIDNAllowedScriptList): Renamed. Also use a modern for
+        loop to simplify the code.
+
 2020-07-15  Jim Mason  <[email protected]>
 
         [WTF] Fix PackedAlignedPtr for X86_64 canonical addresses

Modified: trunk/Source/WTF/wtf/URLHelpers.cpp (264422 => 264423)


--- trunk/Source/WTF/wtf/URLHelpers.cpp	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WTF/wtf/URLHelpers.cpp	2020-07-15 21:33:28 UTC (rev 264423)
@@ -45,24 +45,24 @@
 constexpr unsigned hostNameBufferLength = 2048;
 constexpr unsigned urlBytesBufferLength = 2048;
 
-// This needs to be higher than the UScriptCode for any of the scripts on the IDN whitelist.
+// This needs to be higher than the UScriptCode for any of the scripts on the IDN allowed list.
 // At one point we used USCRIPT_CODE_LIMIT from ICU, but there are two reasons not to use it.
 // 1) ICU considers it deprecated, so by setting U_HIDE_DEPRECATED we can't see it.
 // 2) No good reason to limit ourselves to scripts that existed in the ICU headers when
 //    WebKit was compiled.
-// This is only really important for platforms that load an external ICU whitelist.
+// This is only really important for platforms that load an external IDN allowed script list.
 // Not important for the compiled-in one.
 constexpr auto scriptCodeLimit = static_cast<UScriptCode>(256);
 
-static uint32_t IDNScriptWhiteList[(scriptCodeLimit + 31) / 32];
+static uint32_t allowedIDNScriptBits[(scriptCodeLimit + 31) / 32];
 
 #if !PLATFORM(COCOA)
 
-// Cocoa has an implementation that uses a whitelist in /Library or ~/Library, if it exists.
-void loadIDNScriptWhiteList()
+// Cocoa has an implementation that reads this from a file in /Library or ~/Library.
+void loadIDNAllowedScriptList()
 {
     static std::once_flag flag;
-    std::call_once(flag, initializeDefaultIDNScriptWhiteList);
+    std::call_once(flag, initializeDefaultIDNAllowedScriptList);
 }
 
 #endif // !PLATFORM(COCOA)
@@ -112,7 +112,7 @@
     // any non-printable character, any character considered as whitespace,
     // any ignorable character, and emoji characters related to locks.
     
-    // We also considered the characters in Mozilla's blacklist <http://kb.mozillazine.org/Network.IDN.blacklist_chars>.
+    // We also considered the characters in Mozilla's list of characters <http://kb.mozillazine.org/Network.IDN.blacklist_chars>.
 
     // Some of the characters here will never appear once ICU has encoded.
     // For example, ICU transforms most spaces into an ASCII space and most
@@ -264,28 +264,28 @@
     }
 }
 
-static void whiteListIDNScript(int32_t script)
+static void addScriptToIDNAllowedScriptList(int32_t script)
 {
     if (script >= 0 && script < scriptCodeLimit) {
         size_t index = script / 32;
         uint32_t mask = 1 << (script % 32);
-        IDNScriptWhiteList[index] |= mask;
+        allowedIDNScriptBits[index] |= mask;
     }
 }
 
-static void whiteListIDNScript(UScriptCode script)
+static void addScriptToIDNAllowedScriptList(UScriptCode script)
 {
-    whiteListIDNScript(static_cast<int32_t>(script));
+    addScriptToIDNAllowedScriptList(static_cast<int32_t>(script));
 }
 
-void whiteListIDNScript(const char* scriptName)
+void addScriptToIDNAllowedScriptList(const char* scriptName)
 {
-    whiteListIDNScript(u_getPropertyValueEnum(UCHAR_SCRIPT, scriptName));
+    addScriptToIDNAllowedScriptList(u_getPropertyValueEnum(UCHAR_SCRIPT, scriptName));
 }
 
-void initializeDefaultIDNScriptWhiteList()
+void initializeDefaultIDNAllowedScriptList()
 {
-    constexpr UScriptCode defaultIDNScriptWhiteList[] = {
+    constexpr UScriptCode scripts[] = {
         USCRIPT_COMMON,
         USCRIPT_INHERITED,
         USCRIPT_ARABIC,
@@ -307,13 +307,13 @@
         USCRIPT_THAI,
         USCRIPT_YI,
     };
-    for (auto script : defaultIDNScriptWhiteList)
-        whiteListIDNScript(script);
+    for (auto script : scripts)
+        addScriptToIDNAllowedScriptList(script);
 }
 
-static bool allCharactersInIDNScriptWhiteList(const UChar* buffer, int32_t length)
+static bool allCharactersInAllowedIDNScriptList(const UChar* buffer, int32_t length)
 {
-    loadIDNScriptWhiteList();
+    loadIDNAllowedScriptList();
     int32_t i = 0;
     Optional<UChar32> previousCodePoint;
     while (i < length) {
@@ -334,7 +334,7 @@
 
         size_t index = script / 32;
         uint32_t mask = 1 << (script % 32);
-        if (!(IDNScriptWhiteList[index] & mask))
+        if (!(allowedIDNScriptBits[index] & mask))
             return false;
         
         if (isLookalikeCharacter(previousCodePoint, c))
@@ -572,7 +572,7 @@
     if (numCharactersConverted == static_cast<int32_t>(length) && !memcmp(sourceBuffer.data(), destinationBuffer, length * sizeof(UChar)))
         return String();
 
-    if (!decodeFunction && !allCharactersInIDNScriptWhiteList(destinationBuffer, numCharactersConverted) && !allCharactersAllowedByTLDRules(destinationBuffer, numCharactersConverted))
+    if (!decodeFunction && !allCharactersInAllowedIDNScriptList(destinationBuffer, numCharactersConverted) && !allCharactersAllowedByTLDRules(destinationBuffer, numCharactersConverted))
         return String();
 
     return String(destinationBuffer, numCharactersConverted);

Modified: trunk/Source/WTF/wtf/URLHelpers.h (264422 => 264423)


--- trunk/Source/WTF/wtf/URLHelpers.h	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WTF/wtf/URLHelpers.h	2020-07-15 21:33:28 UTC (rev 264423)
@@ -37,9 +37,9 @@
 using URLDecodeFunction = String(*)(const String&);
 
 WTF_EXPORT_PRIVATE String userVisibleURL(const CString& URL);
-void loadIDNScriptWhiteList();
-void whiteListIDNScript(const char* scriptName);
-void initializeDefaultIDNScriptWhiteList();
+void loadIDNAllowedScriptList();
+void addScriptToIDNAllowedScriptList(const char* scriptName);
+void initializeDefaultIDNAllowedScriptList();
 Optional<String> mapHostName(const String&, URLDecodeFunction);
 String mapHostNames(const String&, URLDecodeFunction);
 

Modified: trunk/Source/WTF/wtf/cocoa/NSURLExtras.mm (264422 => 264423)


--- trunk/Source/WTF/wtf/cocoa/NSURLExtras.mm	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WTF/wtf/cocoa/NSURLExtras.mm	2020-07-15 21:33:28 UTC (rev 264423)
@@ -42,7 +42,7 @@
 
 constexpr unsigned urlBytesBufferLength = 2048;
 
-static BOOL readIDNScriptWhiteListFile(NSString *filename)
+static BOOL readIDNAllowedScriptListFile(NSString *filename)
 {
     if (!filename)
         return NO;
@@ -66,7 +66,7 @@
         
         if (result == 1) {
             // Got a word, map to script code and put it into the array.
-            whiteListIDNScript(word);
+            addScriptToIDNAllowedScriptList(word);
         }
     }
     fclose(file);
@@ -75,18 +75,15 @@
 
 namespace URLHelpers {
 
-void loadIDNScriptWhiteList()
+void loadIDNAllowedScriptList()
 {
     static dispatch_once_t flag;
     dispatch_once(&flag, ^{
-        // Read white list from library.
-        NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES);
-        int numDirs = [dirs count];
-        for (int i = 0; i < numDirs; i++) {
-            if (readIDNScriptWhiteListFile([[dirs objectAtIndex:i] stringByAppendingPathComponent:@"IDNScriptWhiteList.txt"]))
+        for (NSString *directory in NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES)) {
+            if (readIDNAllowedScriptListFile([directory stringByAppendingPathComponent:@"IDNScriptWhiteList.txt"]))
                 return;
         }
-        initializeDefaultIDNScriptWhiteList();
+        initializeDefaultIDNAllowedScriptList();
     });
 }
 

Modified: trunk/Source/WebKit/ChangeLog (264422 => 264423)


--- trunk/Source/WebKit/ChangeLog	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WebKit/ChangeLog	2020-07-15 21:33:28 UTC (rev 264423)
@@ -1,3 +1,13 @@
+2020-07-15  Darin Adler  <[email protected]>
+
+        Remove a few more uses of the terms black/white list
+        https://bugs.webkit.org/show_bug.cgi?id=214371
+
+        Reviewed by Alex Christensen.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::shouldPlugInAutoStartFromOrigin): Reworded a comment.
+
 2020-07-15  Devin Rousso  <[email protected]>
 
         should represent `TextPlaceholderElement` as an `NSTextAttachmentCharacter` instead of a `\n`

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (264422 => 264423)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2020-07-15 21:33:28 UTC (rev 264423)
@@ -921,7 +921,7 @@
         return true;
 
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
-    // The plugin wasn't in the general whitelist, so check if it similar to the primary plugin for the page (if we've found one).
+    // The plugin wasn't in the general list, so check if it similar to the primary plugin for the page (if we've found one).
     if (webPage.matchesPrimaryPlugIn(pageOrigin, pluginOrigin, mimeType))
         return true;
 #else

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (264422 => 264423)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-07-15 21:33:28 UTC (rev 264423)
@@ -1,3 +1,12 @@
+2020-07-15  Darin Adler  <[email protected]>
+
+        Remove a few more uses of the terms black/white list
+        https://bugs.webkit.org/show_bug.cgi?id=214371
+
+        Reviewed by Alex Christensen.
+
+        * WebView/WebViewPrivate.h: Corrected a mistake in a comment.
+
 2020-07-13  Keith Miller  <[email protected]>
 
         Clean up SourceProvider and add caller relative load script to jsc.cpp

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h (264422 => 264423)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h	2020-07-15 21:31:00 UTC (rev 264422)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h	2020-07-15 21:33:28 UTC (rev 264423)
@@ -800,7 +800,7 @@
 + (void)_addOriginAccessAllowListEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
 + (void)_removeOriginAccessAllowListEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
 
-// Removes all white list entries created with _addOriginAccessAllowListEntryWithSourceOrigin.
+// Removes all allow list entries created with _addOriginAccessAllowListEntryWithSourceOrigin.
 + (void)_resetOriginAccessAllowLists;
 
 // FIXME: The following two methods are deprecated in favor of the overloads below that take the WebUserContentInjectedFrames argument. https://bugs.webkit.org/show_bug.cgi?id=41800.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to