Changeset 236703 in webkit


Ignore:
Timestamp:
Oct 1, 2018, 5:21:14 PM (7 years ago)
Author:
achristensen@apple.com
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.

Location:
trunk/Source/WebCore
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r236702 r236703  
     12018-10-01  Alex Christensen  <achristensen@webkit.org>
     2
     3        Don't read from WebCore's bundle for IDNScriptWhiteList
     4        https://bugs.webkit.org/show_bug.cgi?id=190157
     5
     6        Reviewed by Dan Bernstein.
     7
     8        No change in behavior.  This increases performance by not reading from the WebCore bundle,
     9        and it makes it so that URL-related functionality can be moved to a place without
     10        a bundle for resources.
     11
     12        * Resources/IDNScriptWhiteList.txt: Removed.
     13        * WebCore.xcodeproj/project.pbxproj:
     14        * platform/mac/WebCoreNSURLExtras.mm:
     15        (WebCore::whiteListIDNScripts):
     16        (WebCore::allCharactersInIDNScriptWhiteList):
     17        (WebCore::readIDNScriptWhiteListFile): Deleted.
     18
    1192018-10-01  Alex Christensen  <achristensen@webkit.org>
    220
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r236678 r236703  
    22552255                7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */; };
    22562256                7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
    2257                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
    22582257                7CC9722E1F93E3360004D4CF /* SettingsBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC660991F93057800D500E9 /* SettingsBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
    22592258                7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D531DD7B09300128552 /* SVGLengthValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    96839682                7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
    96849683                7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = "<group>"; };
    9685                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
    96869684                7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMCallbackMicrotask.cpp; sourceTree = "<group>"; };
    96879685                7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = "<group>"; };
     
    1576715765                                A1AA9AB81D23911500FEADB3 /* ContentFilterBlockedPage.html */,
    1576815766                                A11E8C001B1E28BE0003A7C7 /* copyCursor.png */,
    15769                                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */,
    1577015767                                2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */,
    1577115768                                BCAD1808131C7A0D00990406 /* Localizable.strings */,
     
    3138031377                                A1AA9AB91D23911500FEADB3 /* ContentFilterBlockedPage.html in Resources */,
    3138131378                                A11E8C051B1E28F40003A7C7 /* copyCursor.png in Resources */,
    31382                                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */,
    3138331379                                2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */,
    3138431380                                E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */,
  • trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm

    r236702 r236703  
    248248}
    249249
     250static void whiteListIDNScript(const char* scriptName)
     251{
     252    int32_t script = u_getPropertyValueEnum(UCHAR_SCRIPT, scriptName);
     253    if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
     254        size_t index = script / 32;
     255        uint32_t mask = 1 << (script % 32);
     256        IDNScriptWhiteList[index] |= mask;
     257    }
     258}
     259
    250260static BOOL readIDNScriptWhiteListFile(NSString *filename)
    251261{
     
    272282        if (result == 1) {
    273283            // Got a word, map to script code and put it into the array.
    274             int32_t script = u_getPropertyValueEnum(UCHAR_SCRIPT, word);
    275             if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
    276                 size_t index = script / 32;
    277                 uint32_t mask = 1 << (script % 32);
    278                 IDNScriptWhiteList[index] |= mask;
    279             }
     284            whiteListIDNScript(word);
    280285        }
    281286    }
     
    295300                return;
    296301        }
    297 
    298         // Fall back on white list inside bundle.
    299         NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebCore"];
    300 
    301         if (!readIDNScriptWhiteListFile([bundle pathForResource:@"IDNScriptWhiteList" ofType:@"txt"]))
    302             CRASH();
     302        const char* defaultIDNScriptWhiteList[20] = {
     303            "Common",
     304            "Inherited",
     305            "Arabic",
     306            "Armenian",
     307            "Bopomofo",
     308            "Canadian_Aboriginal",
     309            "Devanagari",
     310            "Deseret",
     311            "Gujarati",
     312            "Gurmukhi",
     313            "Hangul",
     314            "Han",
     315            "Hebrew",
     316            "Hiragana",
     317            "Katakana_Or_Hiragana",
     318            "Katakana",
     319            "Latin",
     320            "Tamil",
     321            "Thai",
     322            "Yi",
     323        };
     324        for (const char* scriptName : defaultIDNScriptWhiteList)
     325            whiteListIDNScript(scriptName);
    303326    });
    304327   
Note: See TracChangeset for help on using the changeset viewer.