Diff
Modified: trunk/Source/WebCore/ChangeLog (236817 => 236818)
--- trunk/Source/WebCore/ChangeLog 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/ChangeLog 2018-10-04 00:50:46 UTC (rev 236818)
@@ -1,3 +1,44 @@
+2018-10-03 Jer Noble <jer.no...@apple.com>
+
+ Add a quirk to disable Modern EME for sites which are broken with it enabled
+ https://bugs.webkit.org/show_bug.cgi?id=190051
+
+ Reviewed by Daniel Bates.
+
+ Add a new class, parallel to Settings, to track quirk behavior. Extend the bindings
+ generator to support a DisabledByQuirk attribute, and set this attribute for all
+ the Modern EME types. Check whether the quirk is set inside HTMLMediaElement in
+ addition to the existing Setting.
+
+ * Modules/encryptedmedia/MediaKeyMessageEvent.idl:
+ * Modules/encryptedmedia/MediaKeySession.idl:
+ * Modules/encryptedmedia/MediaKeyStatusMap.idl:
+ * Modules/encryptedmedia/MediaKeySystemAccess.idl:
+ * Modules/encryptedmedia/MediaKeys.idl:
+ * Modules/encryptedmedia/NavigatorEME.idl:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/scripts/CodeGenerator.pm:
+ (WK_ucfirst):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (NeedsRuntimeCheck):
+ (GenerateRuntimeEnableConditionalString):
+ * bindings/scripts/IDLAttributes.json:
+ * bindings/scripts/preprocess-idls.pl:
+ (GenerateConstructorAttributes):
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ * dom/Document.h:
+ (WebCore::Document::quirks const):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
+ (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
+ * html/HTMLMediaElement.idl:
+ * page/Quirks.cpp: Added.
+ (Quirks::Quirks):
+ (Quirks::disableEncryptedMediaAPIQuirk const):
+ * page/Quirks.h: Added.
+
2018-10-03 Antoine Quint <grao...@apple.com>
[Web Animations] REGRESSION: setting 'animation-name: none' after a 'fill: forwards' animation has completed does not revert to the unanimated style
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl (236817 => 236818)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -41,7 +41,8 @@
[
Conditional=ENCRYPTED_MEDIA,
Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict),
- EnabledAtRuntime=EncryptedMediaAPI
+ EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
] interface MediaKeyMessageEvent : Event {
readonly attribute MediaKeyMessageType messageType;
readonly attribute ArrayBuffer message;
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl (236817 => 236818)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -28,7 +28,8 @@
[
Conditional=ENCRYPTED_MEDIA,
- EnabledAtRuntime=EncryptedMediaAPI
+ EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
] interface MediaKeySession : EventTarget {
readonly attribute DOMString sessionId;
readonly attribute unrestricted double expiration;
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.idl (236817 => 236818)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -38,7 +38,8 @@
[
Conditional=ENCRYPTED_MEDIA,
- EnabledAtRuntime=EncryptedMediaAPI
+ EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
] interface MediaKeyStatusMap {
iterable<BufferSource, MediaKeyStatus>;
readonly attribute unsigned long size;
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.idl (236817 => 236818)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -29,6 +29,7 @@
[
Conditional=ENCRYPTED_MEDIA,
EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
ImplementationLacksVTable,
] interface MediaKeySystemAccess {
readonly attribute DOMString keySystem;
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl (236817 => 236818)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -29,6 +29,7 @@
[
Conditional=ENCRYPTED_MEDIA,
EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
ImplementationLacksVTable,
] interface MediaKeys {
[CallWith=ScriptExecutionContext, MayThrowException] MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary");
Modified: trunk/Source/WebCore/Modules/encryptedmedia/NavigatorEME.idl (236817 => 236818)
--- trunk/Source/WebCore/Modules/encryptedmedia/NavigatorEME.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Modules/encryptedmedia/NavigatorEME.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -28,7 +28,8 @@
[
Conditional=ENCRYPTED_MEDIA,
- EnabledAtRuntime=EncryptedMediaAPI
+ EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
] partial interface Navigator {
[CallWith=Document] Promise<MediaKeySystemAccess> requestMediaKeySystemAccess(DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfiguration);
};
Modified: trunk/Source/WebCore/Sources.txt (236817 => 236818)
--- trunk/Source/WebCore/Sources.txt 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/Sources.txt 2018-10-04 00:50:46 UTC (rev 236818)
@@ -1420,6 +1420,7 @@
page/PointerLockController.cpp
page/PrintContext.cpp
page/ProcessWarming.cpp
+page/Quirks.cpp
page/RemoteDOMWindow.cpp
page/RemoteFrame.cpp
page/ResourceUsageOverlay.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (236817 => 236818)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-04 00:50:46 UTC (rev 236818)
@@ -13343,6 +13343,8 @@
CD94A5D61F71CB6D00F525C5 /* CDMMessageType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMMessageType.h; sourceTree = "<group>"; };
CD94A5DA1F71CBB000F525C5 /* CDMClearKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMClearKey.h; sourceTree = "<group>"; };
CD94A5DB1F71CBB000F525C5 /* CDMClearKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDMClearKey.cpp; sourceTree = "<group>"; };
+ CD9A87F9215D6CF3006F17B5 /* Quirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Quirks.cpp; sourceTree = "<group>"; };
+ CD9A87FB215D6CF3006F17B5 /* Quirks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Quirks.h; sourceTree = "<group>"; };
CD9D375A215163E40049657B /* CDMInstanceSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDMInstanceSession.h; sourceTree = "<group>"; };
CD9D82731C7AE535006FF066 /* TextureCacheCV.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextureCacheCV.mm; sourceTree = "<group>"; };
CD9D82741C7AE535006FF066 /* TextureCacheCV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureCacheCV.h; sourceTree = "<group>"; };
@@ -19534,6 +19536,8 @@
B776D43A1104525D00BEB0EC /* PrintContext.h */,
E42050162141901B0066EF3B /* ProcessWarming.cpp */,
E42050142141901A0066EF3B /* ProcessWarming.h */,
+ CD9A87F9215D6CF3006F17B5 /* Quirks.cpp */,
+ CD9A87FB215D6CF3006F17B5 /* Quirks.h */,
46B9518D207D632A00A7D2DD /* RemoteDOMWindow.cpp */,
46B9518E207D632A00A7D2DD /* RemoteDOMWindow.h */,
46BCBBC3208500A700710638 /* RemoteDOMWindow.idl */,
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (236817 => 236818)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-10-04 00:50:46 UTC (rev 236818)
@@ -1705,6 +1705,7 @@
return $context->extendedAttributes->{EnabledAtRuntime}
|| $context->extendedAttributes->{EnabledForWorld}
|| $context->extendedAttributes->{EnabledBySetting}
+ || $context->extendedAttributes->{DisabledByQuirk}
|| $context->extendedAttributes->{SecureContext}
|| $context->extendedAttributes->{ContextHasServiceWorkerScheme};
}
@@ -3721,6 +3722,20 @@
}
}
+ if ($context->extendedAttributes->{DisabledByQuirk}) {
+ assert("Must specify value for DisabledByQuirk.") if $context->extendedAttributes->{DisabledByQuirk} eq "VALUE_IS_MISSING";
+
+ AddToImplIncludes("Document.h");
+ AddToImplIncludes("Quirks.h");
+
+ assert("DisabledByQuirk can only be used by interfaces only exposed to the Window") if $interface->extendedAttributes->{Exposed} && $interface->extendedAttributes->{Exposed} ne "Window";
+
+ my @flags = split(/&/, $context->extendedAttributes->{DisabledByQuirk});
+ foreach my $flag (@flags) {
+ push(@conjuncts, "!downcast<Document>(jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext())->quirks()." . ToMethodName($flag) . "Quirk()");
+ }
+ }
+
if ($context->extendedAttributes->{EnabledAtRuntime}) {
assert("Must specify value for EnabledAtRuntime.") if $context->extendedAttributes->{EnabledAtRuntime} eq "VALUE_IS_MISSING";
Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (236817 => 236818)
--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json 2018-10-04 00:50:46 UTC (rev 236818)
@@ -181,6 +181,10 @@
"contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant"],
"values": ["*"]
},
+ "DisabledByQuirk": {
+ "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant"],
+ "values": ["*"]
+ },
"EnabledForWorld": {
"contextsAllowed": ["attribute", "operation"],
"values": ["*"]
Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (236817 => 236818)
--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -258,7 +258,7 @@
foreach my $attributeName (sort keys %{$extendedAttributes}) {
next unless ($attributeName eq "Conditional" || $attributeName eq "EnabledAtRuntime" || $attributeName eq "EnabledForWorld"
|| $attributeName eq "EnabledBySetting" || $attributeName eq "SecureContext" || $attributeName eq "PrivateIdentifier"
- || $attributeName eq "PublicIdentifier");
+ || $attributeName eq "PublicIdentifier" || $attributeName eq "DisabledByQuirk");
my $extendedAttribute = $attributeName;
$extendedAttribute .= "=" . $extendedAttributes->{$attributeName} unless $extendedAttributes->{$attributeName} eq "VALUE_IS_MISSING";
push(@extendedAttributesList, $extendedAttribute);
Modified: trunk/Source/WebCore/dom/Document.cpp (236817 => 236818)
--- trunk/Source/WebCore/dom/Document.cpp 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/dom/Document.cpp 2018-10-04 00:50:46 UTC (rev 236818)
@@ -150,6 +150,7 @@
#include "PopStateEvent.h"
#include "ProcessingInstruction.h"
#include "PublicSuffix.h"
+#include "Quirks.h"
#include "RealtimeMediaSourceCenter.h"
#include "RenderChildIterator.h"
#include "RenderInline.h"
@@ -489,6 +490,7 @@
, m_touchEventsChangedTimer(*this, &Document::touchEventsChangedTimerFired)
#endif
, m_settings(frame ? Ref<Settings>(frame->settings()) : Settings::create(nullptr))
+ , m_quirks(makeUniqueRef<Quirks>(*this))
, m_cachedResourceLoader(m_frame ? Ref<CachedResourceLoader>(m_frame->loader().activeDocumentLoader()->cachedResourceLoader()) : CachedResourceLoader::create(nullptr))
, m_domTreeVersion(++s_globalTreeVersion)
, m_styleScope(std::make_unique<Style::Scope>(*this))
Modified: trunk/Source/WebCore/dom/Document.h (236817 => 236818)
--- trunk/Source/WebCore/dom/Document.h 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/dom/Document.h 2018-10-04 00:50:46 UTC (rev 236818)
@@ -63,6 +63,7 @@
#include <wtf/HashSet.h>
#include <wtf/Logger.h>
#include <wtf/ObjectIdentifier.h>
+#include <wtf/UniqueRef.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/AtomicStringHash.h>
@@ -155,6 +156,7 @@
class PlatformMouseEvent;
class ProcessingInstruction;
class QualifiedName;
+class Quirks;
class Range;
class RenderFullScreen;
class RenderTreeBuilder;
@@ -565,6 +567,8 @@
const Settings& settings() const { return m_settings.get(); }
Settings& mutableSettings() { return m_settings.get(); }
+ const Quirks& quirks() const { return m_quirks; }
+
float deviceScaleFactor() const;
bool useSystemAppearance() const;
@@ -1628,6 +1632,8 @@
const Ref<Settings> m_settings;
+ UniqueRef<Quirks> m_quirks;
+
std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;
RefPtr<DOMWindow> m_domWindow;
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (236817 => 236818)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2018-10-04 00:50:46 UTC (rev 236818)
@@ -73,6 +73,7 @@
#include "PlatformMediaSessionManager.h"
#include "ProgressTracker.h"
#include "PublicSuffix.h"
+#include "Quirks.h"
#include "RenderLayerCompositor.h"
#include "RenderTheme.h"
#include "RenderVideo.h"
@@ -2627,7 +2628,7 @@
#if ENABLE(ENCRYPTED_MEDIA)
// Only fire an error if ENCRYPTED_MEDIA is not enabled, to give clients of the
// "encrypted" event a chance to handle it without resulting in a synthetic error.
- && !RuntimeEnabledFeatures::sharedFeatures().encryptedMediaAPIEnabled()
+ && (!RuntimeEnabledFeatures::sharedFeatures().encryptedMediaAPIEnabled() || document().quirks().hasBrokenEncryptedMediaAPISupportQuirk())
#endif
) {
m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED);
@@ -2763,7 +2764,7 @@
void HTMLMediaElement::mediaPlayerInitializationDataEncountered(const String& initDataType, RefPtr<ArrayBuffer>&& initData)
{
- if (!RuntimeEnabledFeatures::sharedFeatures().encryptedMediaAPIEnabled())
+ if (!RuntimeEnabledFeatures::sharedFeatures().encryptedMediaAPIEnabled() || document().quirks().hasBrokenEncryptedMediaAPISupportQuirk())
return;
// https://w3c.github.io/encrypted-media/#initdata-encountered
Modified: trunk/Source/WebCore/html/HTMLMediaElement.idl (236817 => 236818)
--- trunk/Source/WebCore/html/HTMLMediaElement.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/html/HTMLMediaElement.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -104,10 +104,10 @@
[Conditional=LEGACY_ENCRYPTED_MEDIA, EnabledAtRuntime=LegacyEncryptedMediaAPI] readonly attribute WebKitMediaKeys webkitKeys;
[Conditional=LEGACY_ENCRYPTED_MEDIA, EnabledAtRuntime=LegacyEncryptedMediaAPI] void webkitSetMediaKeys(WebKitMediaKeys? mediaKeys);
- [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] readonly attribute MediaKeys mediaKeys;
- [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] attribute EventHandler onencrypted;
- [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] attribute EventHandler onwaitingforkey;
- [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] Promise<void> setMediaKeys(MediaKeys? mediaKeys);
+ [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI, DisabledByQuirk=hasBrokenEncryptedMediaAPISupport] readonly attribute MediaKeys mediaKeys;
+ [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI, DisabledByQuirk=hasBrokenEncryptedMediaAPISupport] attribute EventHandler onencrypted;
+ [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI, DisabledByQuirk=hasBrokenEncryptedMediaAPISupport] attribute EventHandler onwaitingforkey;
+ [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI, DisabledByQuirk=hasBrokenEncryptedMediaAPISupport] Promise<void> setMediaKeys(MediaKeys? mediaKeys);
[Conditional=VIDEO_TRACK, MayThrowException] TextTrack addTextTrack(DOMString kind, optional DOMString label = "", optional DOMString language = "");
[Conditional=VIDEO_TRACK, ImplementedAs=ensureAudioTracks] readonly attribute AudioTrackList audioTracks;
Modified: trunk/Source/WebCore/html/MediaEncryptedEvent.idl (236817 => 236818)
--- trunk/Source/WebCore/html/MediaEncryptedEvent.idl 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/html/MediaEncryptedEvent.idl 2018-10-04 00:50:46 UTC (rev 236818)
@@ -34,7 +34,8 @@
[
Conditional=ENCRYPTED_MEDIA,
Constructor(DOMString type, optional MediaEncryptedEventInit eventInitDict),
- EnabledAtRuntime=EncryptedMediaAPI
+ EnabledAtRuntime=EncryptedMediaAPI,
+ DisabledByQuirk=hasBrokenEncryptedMediaAPISupport,
] interface MediaEncryptedEvent : Event {
readonly attribute DOMString initDataType;
readonly attribute ArrayBuffer? initData;
Added: trunk/Source/WebCore/page/Quirks.cpp (0 => 236818)
--- trunk/Source/WebCore/page/Quirks.cpp (rev 0)
+++ trunk/Source/WebCore/page/Quirks.cpp 2018-10-04 00:50:46 UTC (rev 236818)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Quirks.h"
+
+#include "Document.h"
+#include "Settings.h"
+
+namespace WebCore {
+
+Quirks::Quirks(Document& document)
+ : m_document(makeWeakPtr(document))
+{
+}
+
+Quirks::~Quirks() = default;
+
+bool Quirks::hasBrokenEncryptedMediaAPISupportQuirk() const
+{
+ if (!m_document || !m_document->settings().needsSiteSpecificQuirks())
+ return false;
+
+ if (m_hasBrokenEncryptedMediaAPISupportQuirk)
+ return m_hasBrokenEncryptedMediaAPISupportQuirk.value();
+
+ auto domain = m_document->securityOrigin().domain().convertToASCIILowercase();
+
+ m_hasBrokenEncryptedMediaAPISupportQuirk = domain == "amazon.com"
+ || domain.endsWith(".amazon.com")
+ || domain == "primevideo.com"
+ || domain.endsWith(".primevideo.com")
+ || domain == "starz.com"
+ || domain.endsWith(".starz.com")
+ || domain == "hulu.com"
+ || domain.endsWith("hulu.com");
+
+ return m_hasBrokenEncryptedMediaAPISupportQuirk.value();
+}
+
+}
Added: trunk/Source/WebCore/page/Quirks.h (0 => 236818)
--- trunk/Source/WebCore/page/Quirks.h (rev 0)
+++ trunk/Source/WebCore/page/Quirks.h 2018-10-04 00:50:46 UTC (rev 236818)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+class Document;
+
+class Quirks {
+ WTF_MAKE_NONCOPYABLE(Quirks); WTF_MAKE_FAST_ALLOCATED;
+public:
+ Quirks(Document&);
+ ~Quirks();
+
+ bool hasBrokenEncryptedMediaAPISupportQuirk() const;
+
+private:
+ WeakPtr<Document> m_document;
+
+ mutable std::optional<bool> m_hasBrokenEncryptedMediaAPISupportQuirk;
+};
+
+}
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp (236817 => 236818)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp 2018-10-04 00:49:48 UTC (rev 236817)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp 2018-10-04 00:50:46 UTC (rev 236818)
@@ -29,6 +29,7 @@
#include "ContentSecurityPolicy.h"
#include "SecurityOriginData.h"
+#include "TextEncoding.h"
#include "URL.h"
namespace WebCore {