Changeset 242278 in webkit


Ignore:
Timestamp:
Mar 1, 2019 11:55:48 AM (5 years ago)
Author:
sihui_liu@apple.com
Message:

Add a quirk for bostongloble.com and latimes.com
https://bugs.webkit.org/show_bug.cgi?id=195155

Reviewed by Geoffrey Garen.

Covered by manual testing.

  • Modules/webdatabase/DOMWindowWebDatabase.idl:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateRuntimeEnableConditionalString):

  • bindings/scripts/IDLAttributes.json:
  • bindings/scripts/preprocess-idls.pl:

(GenerateConstructorAttributes):

  • page/Quirks.cpp:

(WebCore::Quirks::hasWebSQLSupportQuirk const):

  • page/Quirks.h:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242275 r242278  
     12019-03-01  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Add a quirk for bostongloble.com and latimes.com
     4        https://bugs.webkit.org/show_bug.cgi?id=195155
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Covered by manual testing.
     9
     10        * Modules/webdatabase/DOMWindowWebDatabase.idl:
     11        * bindings/scripts/CodeGeneratorJS.pm:
     12        (GenerateRuntimeEnableConditionalString):
     13        * bindings/scripts/IDLAttributes.json:
     14        * bindings/scripts/preprocess-idls.pl:
     15        (GenerateConstructorAttributes):
     16        * page/Quirks.cpp:
     17        (WebCore::Quirks::hasWebSQLSupportQuirk const):
     18        * page/Quirks.h:
     19
    1202019-03-01  Zalan Bujtas  <zalan@apple.com>
    221
  • trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl

    r237210 r242278  
    2727[
    2828    EnabledAtRuntime=WebSQL,
     29    EnabledByQuirk=hasWebSQLSupport,
    2930]
    3031partial interface DOMWindow {
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r241602 r242278  
    37503750        AddToImplIncludes("RuntimeEnabledFeatures.h");
    37513751
    3752         my @flags = split(/&/, $context->extendedAttributes->{EnabledAtRuntime});
    3753         foreach my $flag (@flags) {
    3754             push(@conjuncts, "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($flag) . "Enabled()");
     3752        if ($context->extendedAttributes->{EnabledByQuirk}) {
     3753            AddToImplIncludes("Document.h");
     3754            AddToImplIncludes("Quirks.h");
     3755           
     3756            assert("EnabledByQuirks can only be used by interfaces only exposed to the Window") if $interface->extendedAttributes->{Exposed} && $interface->extendedAttributes->{Exposed} ne "Window";
     3757   
     3758            my @quirkFlags = split(/&/, $context->extendedAttributes->{EnabledByQuirk});
     3759            my @runtimeFlags = split(/&/, $context->extendedAttributes->{EnabledAtRuntime});
     3760            my @quirks;
     3761            my @runtimes;
     3762            foreach my $flag (@quirkFlags) {
     3763                push(@quirks, "downcast<Document>(jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext())->quirks()." . ToMethodName($flag) . "Quirk()");
     3764            }
     3765            foreach my $flag (@runtimeFlags) {
     3766                push(@runtimes, "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($flag) . "Enabled()");
     3767            }
     3768            push(@conjuncts, "(" . join(" && ", @quirks) . " || " . join(" && ", @runtimes) .")");
     3769        } else {
     3770            my @flags = split(/&/, $context->extendedAttributes->{EnabledAtRuntime});
     3771            foreach my $flag (@flags) {
     3772                push(@conjuncts, "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($flag) . "Enabled()");
     3773            }
    37553774        }
    37563775    }
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.json

    r241602 r242278  
    189189            "values": ["*"]
    190190        },
     191        "EnabledByQuirk": {
     192            "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant"],
     193            "values": ["*"]
     194        },
    191195        "EnabledForWorld": {
    192196            "contextsAllowed": ["attribute", "operation"],
  • trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl

    r239472 r242278  
    275275      next unless ($attributeName eq "Conditional" || $attributeName eq "EnabledAtRuntime" || $attributeName eq "EnabledForWorld"
    276276        || $attributeName eq "EnabledBySetting" || $attributeName eq "SecureContext" || $attributeName eq "PrivateIdentifier"
    277         || $attributeName eq "PublicIdentifier" || $attributeName eq "DisabledByQuirk");
     277        || $attributeName eq "PublicIdentifier" || $attributeName eq "DisabledByQuirk" || $attributeName eq "EnabledByQuirk");
    278278      my $extendedAttribute = $attributeName;
    279279      $extendedAttribute .= "=" . $extendedAttributes->{$attributeName} unless $extendedAttributes->{$attributeName} eq "VALUE_IS_MISSING";
  • trunk/Source/WebCore/page/Quirks.cpp

    r240112 r242278  
    5757}
    5858
     59bool Quirks::hasWebSQLSupportQuirk() const
     60{
     61    if (!m_document || !m_document->settings().needsSiteSpecificQuirks())
     62        return false;
     63   
     64    if (m_hasWebSQLSupportQuirk)
     65        return m_hasWebSQLSupportQuirk.value();
     66   
     67    auto domain = m_document->securityOrigin().domain().convertToASCIILowercase();
     68   
     69    m_hasWebSQLSupportQuirk = domain == "bostongloble.com"
     70    || domain.endsWith(".bostongloble.com")
     71    || domain == "latimes.com"
     72    || domain.endsWith(".latimes.com");
     73   
     74    return m_hasWebSQLSupportQuirk.value();
    5975}
     76
     77}
  • trunk/Source/WebCore/page/Quirks.h

    r239427 r242278  
    3939
    4040    bool hasBrokenEncryptedMediaAPISupportQuirk() const;
     41    bool hasWebSQLSupportQuirk() const;
    4142
    4243private:
     
    4445
    4546    mutable Optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk;
     47    mutable Optional<bool> m_hasWebSQLSupportQuirk;
    4648};
    4749
Note: See TracChangeset for help on using the changeset viewer.