Title: [195335] trunk/Source/WebCore
Revision
195335
Author
[email protected]
Date
2016-01-19 19:50:50 -0800 (Tue, 19 Jan 2016)

Log Message

Unreviewed, rolling out r195302.
https://bugs.webkit.org/show_bug.cgi?id=153267

This change broke the Windows build, rolling out so it isn't
broken all night before investigation. (Requested by
ryanhaddad on #webkit).

Reverted changeset:

"[EME] Correctly report errors when generating key requests
from AVContentKeySession."
https://bugs.webkit.org/show_bug.cgi?id=151963
http://trac.webkit.org/changeset/195302

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195334 => 195335)


--- trunk/Source/WebCore/ChangeLog	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/ChangeLog	2016-01-20 03:50:50 UTC (rev 195335)
@@ -1,3 +1,19 @@
+2016-01-19  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r195302.
+        https://bugs.webkit.org/show_bug.cgi?id=153267
+
+        This change broke the Windows build, rolling out so it isn't
+        broken all night before investigation. (Requested by
+        ryanhaddad on #webkit).
+
+        Reverted changeset:
+
+        "[EME] Correctly report errors when generating key requests
+        from AVContentKeySession."
+        https://bugs.webkit.org/show_bug.cgi?id=151963
+        http://trac.webkit.org/changeset/195302
+
 2016-01-19  Chris Dumez  <[email protected]>
 
         DOMImplementation.createDocument() should treat undefined namespace as null

Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.h (195334 => 195335)


--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -55,7 +55,7 @@
 public:
     explicit CDM(const String& keySystem);
 
-    enum CDMErrorCode { NoError, UnknownError, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
+    enum CDMErrorCode { UnknownError = 1, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
     static bool supportsKeySystem(const String&);
     static bool keySystemSupportsMimeType(const String& keySystem, const String& mimeType);
     static std::unique_ptr<CDM> create(const String& keySystem);

Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp (195334 => 195335)


--- trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp	2016-01-20 03:50:50 UTC (rev 195335)
@@ -69,7 +69,7 @@
 {
 }
 
-RefPtr<Uint8Array> CDMSessionClearKey::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode)
+RefPtr<Uint8Array> CDMSessionClearKey::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode)
 {
     UNUSED_PARAM(mimeType);
     UNUSED_PARAM(destinationURL);
@@ -96,7 +96,7 @@
     m_cachedKeys.clear();
 }
 
-bool CDMSessionClearKey::update(Uint8Array* rawKeysData, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
+bool CDMSessionClearKey::update(Uint8Array* rawKeysData, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode)
 {
     UNUSED_PARAM(nextMessage);
     UNUSED_PARAM(systemCode);

Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h (195334 => 195335)


--- trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -42,9 +42,9 @@
     virtual CDMSessionType type() override { return CDMSessionTypeClearKey; }
     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
     virtual const String& sessionId() const override { return m_sessionId; }
-    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array*, String&, unsigned short&, uint32_t&) override;
+    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array*, String&, unsigned short&, unsigned long&) override;
     virtual void releaseKeys() override;
-    virtual bool update(Uint8Array*, RefPtr<Uint8Array>&, unsigned short&, uint32_t&) override;
+    virtual bool update(Uint8Array*, RefPtr<Uint8Array>&, unsigned short&, unsigned long&) override;
     virtual RefPtr<ArrayBuffer> cachedKeyForKeyID(const String&) const override;
 
 protected:

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (195334 => 195335)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp	2016-01-20 03:50:50 UTC (rev 195335)
@@ -111,7 +111,7 @@
         // 2. Let destinationURL be null.
         String destinationURL;
         MediaKeyError::Code errorCode = 0;
-        uint32_t systemCode = 0;
+        unsigned long systemCode = 0;
 
         // 3. Use cdm to generate a key request and follow the steps for the first matching condition from the following list:
 
@@ -163,7 +163,7 @@
     while (!m_pendingKeys.isEmpty()) {
         RefPtr<Uint8Array> pendingKey = m_pendingKeys.takeFirst();
         unsigned short errorCode = 0;
-        uint32_t systemCode = 0;
+        unsigned long systemCode = 0;
 
         // NOTE: Continued from step 2. of MediaKeySession::update()
         // 2.1. Let cdm be the cdm loaded in the MediaKeys constructor.
@@ -219,7 +219,7 @@
     m_asyncEventQueue.enqueueEvent(event.release());
 }
 
-void MediaKeySession::sendError(CDMSessionClient::MediaKeyErrorCode errorCode, uint32_t systemCode)
+void MediaKeySession::sendError(CDMSessionClient::MediaKeyErrorCode errorCode, unsigned long systemCode)
 {
     Ref<MediaKeyError> error = MediaKeyError::create(errorCode, systemCode).get();
     setError(error.ptr());

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (195334 => 195335)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -86,7 +86,7 @@
 
     // CDMSessionClient
     virtual void sendMessage(Uint8Array*, String destinationURL) override;
-    virtual void sendError(MediaKeyErrorCode, uint32_t systemCode) override;
+    virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) override;
     virtual String mediaKeysStorageDirectory() const override;
 
     MediaKeys* m_keys;

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (195334 => 195335)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-01-20 03:50:50 UTC (rev 195335)
@@ -6068,8 +6068,6 @@
 		CDC8B5AA18047FF10016E685 /* SourceBufferPrivateAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */; };
 		CDC8B5AB18047FF10016E685 /* SourceBufferPrivateAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */; };
 		CDC8B5AD1804AE5D0016E685 /* SourceBufferPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */; };
-		CDC979F41C498C0900DB50D4 /* WebCoreNSErrorExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */; };
-		CDC979F51C498C0900DB50D4 /* WebCoreNSErrorExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */; };
 		CDCA82961679100F00875714 /* TextTrackRepresentationIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA82941679100F00875714 /* TextTrackRepresentationIOS.mm */; };
 		CDCA98EB18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDCA98EA18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp */; };
 		CDCFABBD18C0AF78006F8450 /* SelectionSubtreeRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCFABBB18C0AE31006F8450 /* SelectionSubtreeRoot.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -13949,8 +13947,6 @@
 		CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SourceBufferPrivateAVFObjC.mm; sourceTree = "<group>"; };
 		CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivateAVFObjC.h; sourceTree = "<group>"; };
 		CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivateClient.h; sourceTree = "<group>"; };
-		CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSErrorExtras.mm; sourceTree = "<group>"; };
-		CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreNSErrorExtras.h; sourceTree = "<group>"; };
 		CDCA82941679100F00875714 /* TextTrackRepresentationIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextTrackRepresentationIOS.mm; sourceTree = "<group>"; };
 		CDCA98E918B2C8D000C12FF9 /* CDMPrivateMediaPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMPrivateMediaPlayer.h; sourceTree = "<group>"; };
 		CDCA98EA18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDMPrivateMediaPlayer.cpp; sourceTree = "<group>"; };
@@ -19752,8 +19748,6 @@
 				310D71931B335C9D009C7B73 /* ThemeCocoa.cpp */,
 				310D71941B335C9D009C7B73 /* ThemeCocoa.h */,
 				46DB7D561B20FE3C005651B2 /* VNodeTrackerCocoa.cpp */,
-				CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */,
-				CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";
@@ -26643,7 +26637,6 @@
 				316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */,
 				BC5EBA110E823E4700B25965 /* KeyframeList.h in Headers */,
 				E15FF7D518C9553800FE4C87 /* KeypressCommand.h in Headers */,
-				CDC979F51C498C0900DB50D4 /* WebCoreNSErrorExtras.h in Headers */,
 				521D46F811AEC9B100514613 /* KillRing.h in Headers */,
 				450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */,
 				A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */,
@@ -28847,7 +28840,6 @@
 				E16A84F914C85CCC002977DF /* CSSBorderImage.cpp in Sources */,
 				BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */,
 				49AE2D8E134EE50C0072920A /* CSSCalculationValue.cpp in Sources */,
-				CDC979F41C498C0900DB50D4 /* WebCoreNSErrorExtras.mm in Sources */,
 				BC604A430DB5634E00204739 /* CSSCanvasValue.cpp in Sources */,
 				E1EBBBD40AAC9B87001FE8E2 /* CSSCharsetRule.cpp in Sources */,
 				BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */,

Modified: trunk/Source/WebCore/html/MediaKeyError.h (195334 => 195335)


--- trunk/Source/WebCore/html/MediaKeyError.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/html/MediaKeyError.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -46,10 +46,10 @@
     };
     typedef unsigned short Code;
 
-    static Ref<MediaKeyError> create(Code code, uint32_t systemCode = 0) { return adoptRef(*new MediaKeyError(code, systemCode)); }
+    static Ref<MediaKeyError> create(Code code, unsigned long systemCode = 0) { return adoptRef(*new MediaKeyError(code, systemCode)); }
 
     Code code() const { return m_code; }
-    uint32_t systemCode() { return m_systemCode; }
+    unsigned long systemCode() { return m_systemCode; }
 
 private:
     explicit MediaKeyError(Code code, unsigned long systemCode) : m_code(code), m_systemCode(systemCode) { }

Modified: trunk/Source/WebCore/html/MediaKeyEvent.h (195334 => 195335)


--- trunk/Source/WebCore/html/MediaKeyEvent.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/html/MediaKeyEvent.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -42,7 +42,7 @@
     RefPtr<Uint8Array> message;
     String defaultURL;
     RefPtr<MediaKeyError> errorCode;
-    uint32_t systemCode;
+    unsigned short systemCode;
 };
 
 class MediaKeyEvent final : public Event {

Deleted: trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h (195334 => 195335)


--- trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#ifndef WebCoreNSErrorExtras_h
-#define WebCoreNSErrorExtras_h
-
-namespace WebCore {
-
-WEBCORE_EXPORT long mediaKeyErrorSystemCode(NSError *);
-
-}
-
-#endif // WebCoreNSErrorExtras_h

Deleted: trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm (195334 => 195335)


--- trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm	2016-01-20 03:50:50 UTC (rev 195335)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#import "config.h"
-#import "WebCoreNSErrorExtras.h"
-
-#import <AVFoundation/AVError.h>
-
-namespace WebCore {
-
-long mediaKeyErrorSystemCode(NSError *error)
-{
-    NSInteger code = [error code];
-
-    if (code == AVErrorUnknown) {
-        NSError* underlyingError = [error.userInfo valueForKey:NSUnderlyingErrorKey];
-        if (underlyingError && [underlyingError isKindOfClass:[NSError class]])
-            return [underlyingError code];
-    }
-
-    return code;
-}
-
-}

Modified: trunk/Source/WebCore/platform/graphics/CDMSession.h (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/CDMSession.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/CDMSession.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -49,7 +49,7 @@
         MediaKeyErrorDomain,
     };
     typedef unsigned short MediaKeyErrorCode;
-    virtual void sendError(MediaKeyErrorCode, uint32_t systemCode) = 0;
+    virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) = 0;
 
     virtual String mediaKeysStorageDirectory() const = 0;
 };
@@ -70,9 +70,9 @@
     virtual CDMSessionType type() { return CDMSessionTypeUnknown; }
     virtual void setClient(CDMSessionClient*) = 0;
     virtual const String& sessionId() const = 0;
-    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode) = 0;
+    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) = 0;
     virtual void releaseKeys() = 0;
-    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode) = 0;
+    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) = 0;
     virtual RefPtr<ArrayBuffer> cachedKeyForKeyID(const String&) const { return nullptr; }
 };
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -49,9 +49,9 @@
 
     // CDMSession
     virtual CDMSessionType type() override { return CDMSessionTypeAVContentKeySession; }
-    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) override;
     virtual void releaseKeys() override;
-    virtual bool update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual bool update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) override;
 
     // CDMSessionMediaSourceAVFObjC
     void addParser(AVStreamDataParser *) override;
@@ -60,7 +60,7 @@
     void didProvideContentKeyRequest(AVContentKeyRequest *);
 
 protected:
-    PassRefPtr<Uint8Array> generateKeyReleaseMessage(unsigned short& errorCode, uint32_t& systemCode);
+    PassRefPtr<Uint8Array> generateKeyReleaseMessage(unsigned short& errorCode, unsigned long& systemCode);
 
     bool hasContentKeySession() const { return m_contentKeySession; }
     AVContentKeySession* contentKeySession();

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm	2016-01-20 03:50:50 UTC (rev 195335)
@@ -37,9 +37,9 @@
 #import "SoftLinking.h"
 #import "SourceBufferPrivateAVFObjC.h"
 #import "UUID.h"
-#import "WebCoreNSErrorExtras.h"
 #import <AVFoundation/AVError.h>
 #import <CoreMedia/CMBase.h>
+#import <cstdlib>
 #import <objc/objc-runtime.h>
 #import <runtime/TypedArrayInlines.h>
 #import <wtf/NeverDestroyed.h>
@@ -144,7 +144,7 @@
     return getAVContentKeySessionClass();
 }
 
-RefPtr<Uint8Array> CDMSessionAVContentKeySession::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode)
+RefPtr<Uint8Array> CDMSessionAVContentKeySession::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode)
 {
     UNUSED_PARAM(mimeType);
     UNUSED_PARAM(destinationURL);
@@ -228,7 +228,7 @@
     return !literal[length];
 }
 
-bool CDMSessionAVContentKeySession::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
+bool CDMSessionAVContentKeySession::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode)
 {
     UNUSED_PARAM(nextMessage);
 
@@ -281,15 +281,9 @@
 
         errorCode = MediaPlayer::NoError;
         systemCode = 0;
-        NSError* error = nil;
-        NSData* requestData = [m_keyRequest contentKeyRequestDataForApp:certificateData.get() contentIdentifier:nil options:options.get() error:&error];
-        if (error) {
-            errorCode = MediaPlayerClient::DomainError;
-            systemCode = mediaKeyErrorSystemCode(error);
-            return false;
-        }
-
+        NSData* requestData = [m_keyRequest contentKeyRequestDataForApp:certificateData.get() contentIdentifier:nil options:options.get() error:nil];
         nextMessage = Uint8Array::create(static_cast<const uint8_t*>([requestData bytes]), [requestData length]);
+
         return false;
     }
 
@@ -312,7 +306,7 @@
     [contentKeySession() removeStreamDataParser:parser];
 }
 
-PassRefPtr<Uint8Array> CDMSessionAVContentKeySession::generateKeyReleaseMessage(unsigned short& errorCode, uint32_t& systemCode)
+PassRefPtr<Uint8Array> CDMSessionAVContentKeySession::generateKeyReleaseMessage(unsigned short& errorCode, unsigned long& systemCode)
 {
     ASSERT(m_mode == KeyRelease);
     m_certificate = m_initData;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -45,9 +45,9 @@
     virtual CDMSessionType type() override { return CDMSessionTypeAVFoundationObjC; }
     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
     virtual const String& sessionId() const override { return m_sessionId; }
-    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) override;
     virtual void releaseKeys() override;
-    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) override;
 
 protected:
     MediaPlayerPrivateAVFoundationObjC* m_parent;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm	2016-01-20 03:50:50 UTC (rev 195335)
@@ -35,7 +35,6 @@
 #import "MediaPlayerPrivateAVFoundationObjC.h"
 #import "SoftLinking.h"
 #import "UUID.h"
-#import "WebCoreNSErrorExtras.h"
 #import <AVFoundation/AVFoundation.h>
 #import <objc/objc-runtime.h>
 
@@ -54,7 +53,7 @@
 {
 }
 
-RefPtr<Uint8Array> CDMSessionAVFoundationObjC::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode)
+RefPtr<Uint8Array> CDMSessionAVFoundationObjC::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode)
 {
     UNUSED_PARAM(mimeType);
 
@@ -62,13 +61,13 @@
     String keyID;
     RefPtr<Uint8Array> certificate;
     if (!MediaPlayerPrivateAVFoundationObjC::extractKeyURIKeyIDAndCertificateFromInitData(initData, keyURI, keyID, certificate)) {
-        errorCode = CDM::UnknownError;
+        errorCode = MediaPlayer::InvalidPlayerState;
         return nullptr;
     }
 
     m_request = m_parent->takeRequestForKeyURI(keyURI);
     if (!m_request) {
-        errorCode = CDM::UnknownError;
+        errorCode = MediaPlayer::InvalidPlayerState;
         return nullptr;
     }
 
@@ -79,8 +78,8 @@
     RetainPtr<NSData> keyRequest = [m_request streamingContentKeyRequestDataForApp:certificateData.get() contentIdentifier:assetID.get() options:nil error:&nsError];
 
     if (!keyRequest) {
-        errorCode = CDM::DomainError;
-        systemCode = mediaKeyErrorSystemCode(nsError);
+        NSError* underlyingError = [[nsError userInfo] objectForKey:NSUnderlyingErrorKey];
+        systemCode = [underlyingError code];
         return nullptr;
     }
 
@@ -96,7 +95,7 @@
 {
 }
 
-bool CDMSessionAVFoundationObjC::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
+bool CDMSessionAVFoundationObjC::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode)
 {
     RetainPtr<NSData> keyData = adoptNS([[NSData alloc] initWithBytes:key->baseAddress() length:key->byteLength()]);
     [[m_request dataRequest] respondWithData:keyData.get()];

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -47,9 +47,9 @@
 
     // CDMSession
     virtual CDMSessionType type() override { return CDMSessionTypeAVStreamSession; }
-    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) override;
     virtual void releaseKeys() override;
-    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) override;
 
     // CDMSessionMediaSourceAVFObjC
     void addParser(AVStreamDataParser*) override;
@@ -58,7 +58,7 @@
     void setStreamSession(AVStreamSession*);
 
 protected:
-    PassRefPtr<Uint8Array> generateKeyReleaseMessage(unsigned short& errorCode, uint32_t systemCode);
+    PassRefPtr<Uint8Array> generateKeyReleaseMessage(unsigned short& errorCode, unsigned long& systemCode);
 
     WeakPtrFactory<CDMSessionAVStreamSession> m_weakPtrFactory;
     RetainPtr<AVStreamSession> m_streamSession;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm	2016-01-20 03:50:50 UTC (rev 195335)
@@ -37,9 +37,9 @@
 #import "SoftLinking.h"
 #import "SourceBufferPrivateAVFObjC.h"
 #import "UUID.h"
-#import "WebCoreNSErrorExtras.h"
 #import <AVFoundation/AVError.h>
 #import <CoreMedia/CMBase.h>
+#import <cstdlib>
 #import <objc/objc-runtime.h>
 #import <runtime/TypedArrayInlines.h>
 #import <wtf/NeverDestroyed.h>
@@ -112,7 +112,7 @@
         removeParser(sourceBuffer->parser());
 }
 
-RefPtr<Uint8Array> CDMSessionAVStreamSession::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode)
+RefPtr<Uint8Array> CDMSessionAVStreamSession::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode)
 {
     UNUSED_PARAM(mimeType);
     UNUSED_PARAM(destinationURL);
@@ -187,7 +187,7 @@
     return !literal[length];
 }
 
-bool CDMSessionAVStreamSession::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
+bool CDMSessionAVStreamSession::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode)
 {
     bool shouldGenerateKeyRequest = !m_certificate || isEqual(key, "renew");
     if (!m_certificate) {
@@ -255,7 +255,7 @@
         if (error) {
             LOG(Media, "CDMSessionAVStreamSession::update(%p) - error:%@", this, [error description]);
             errorCode = MediaPlayer::InvalidPlayerState;
-            systemCode = mediaKeyErrorSystemCode(error);
+            systemCode = std::abs(systemCodeForError(error));
             return false;
         }
 
@@ -304,7 +304,7 @@
         [m_streamSession removeStreamDataParser:parser];
 }
 
-PassRefPtr<Uint8Array> CDMSessionAVStreamSession::generateKeyReleaseMessage(unsigned short& errorCode, uint32_t systemCode)
+PassRefPtr<Uint8Array> CDMSessionAVStreamSession::generateKeyReleaseMessage(unsigned short& errorCode, unsigned long& systemCode)
 {
     ASSERT(m_mode == KeyRelease);
     m_certificate = m_initData;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h	2016-01-20 03:50:50 UTC (rev 195335)
@@ -63,6 +63,7 @@
     void invalidateCDM() { m_cdm = nullptr; }
 
 protected:
+    static long systemCodeForError(NSError *);
     String storagePath() const;
 
     CDMPrivateMediaSourceAVFObjC* m_cdm;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (195334 => 195335)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2016-01-20 03:50:50 UTC (rev 195335)
@@ -30,8 +30,8 @@
 
 #import "CDMPrivateMediaSourceAVFObjC.h"
 #import "FileSystem.h"
-#import "WebCoreNSErrorExtras.h"
 #import <AVFoundation/AVError.h>
+#import <cstdlib>
 
 namespace WebCore {
 
@@ -52,7 +52,7 @@
     if (!m_client)
         return;
 
-    unsigned long code = mediaKeyErrorSystemCode(error);
+    unsigned long code = std::abs(systemCodeForError(error));
 
     // FIXME(142246): Remove the following once <rdar://problem/20027434> is resolved.
     shouldIgnore = m_stopped && code == 12785;
@@ -65,7 +65,7 @@
     if (!m_client)
         return;
 
-    unsigned long code = mediaKeyErrorSystemCode(error);
+    unsigned long code = std::abs(systemCodeForError(error));
 
     // FIXME(142246): Remove the following once <rdar://problem/20027434> is resolved.
     shouldIgnore = m_stopped && code == 12785;
@@ -96,6 +96,19 @@
     m_sourceBuffers.remove(m_sourceBuffers.find(sourceBuffer));
 }
 
+long CDMSessionMediaSourceAVFObjC::systemCodeForError(NSError *error)
+{
+    NSInteger code = [error code];
+    if (code != AVErrorUnknown)
+        return code;
+
+    NSError* underlyingError = [error.userInfo valueForKey:NSUnderlyingErrorKey];
+    if (!underlyingError || ![underlyingError isKindOfClass:[NSError class]])
+        return code;
+
+    return [underlyingError code];
+}
+
 String CDMSessionMediaSourceAVFObjC::storagePath() const
 {
     return m_client ? pathByAppendingComponent(m_client->mediaKeysStorageDirectory(), "SecureStop.plist") : emptyString();

Modified: trunk/Source/WebCore/testing/MockCDM.cpp (195334 => 195335)


--- trunk/Source/WebCore/testing/MockCDM.cpp	2016-01-20 01:18:53 UTC (rev 195334)
+++ trunk/Source/WebCore/testing/MockCDM.cpp	2016-01-20 03:50:50 UTC (rev 195335)
@@ -44,9 +44,9 @@
 
     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
     virtual const String& sessionId() const override { return m_sessionId; }
-    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual RefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) override;
     virtual void releaseKeys() override;
-    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode) override;
+    virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) override;
 
 protected:
     CDMSessionClient* m_client;
@@ -112,7 +112,7 @@
 {
 }
 
-RefPtr<Uint8Array> MockCDMSession::generateKeyRequest(const String&, Uint8Array* initData, String&, unsigned short& errorCode, uint32_t&)
+RefPtr<Uint8Array> MockCDMSession::generateKeyRequest(const String&, Uint8Array* initData, String&, unsigned short& errorCode, unsigned long&)
 {
     for (unsigned i = 0; i < initDataPrefix()->length(); ++i) {
         if (!initData || i >= initData->length() || initData->item(i) != initDataPrefix()->item(i)) {
@@ -128,7 +128,7 @@
     // no-op
 }
 
-bool MockCDMSession::update(Uint8Array* key, RefPtr<Uint8Array>&, unsigned short& errorCode, uint32_t&)
+bool MockCDMSession::update(Uint8Array* key, RefPtr<Uint8Array>&, unsigned short& errorCode, unsigned long&)
 {
     for (unsigned i = 0; i < keyPrefix()->length(); ++i) {
         if (i >= key->length() || key->item(i) != keyPrefix()->item(i)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to