<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[195410] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/195410">195410</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2016-01-21 09:15:16 -0800 (Thu, 21 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[EME] Correctly report errors when generating key requests from AVContentKeySession.
https://bugs.webkit.org/show_bug.cgi?id=151963

Reviewed by Eric Carlson.

WebIDL's &quot;unsigned long&quot; is a 32-bit unsigned integer, and C++'s &quot;unsigned long&quot; is (or, can
be) a 64-bit integer on 64-bit platforms. Casting a negative integer to a 64-bit integer
results in a number which cannot be accurately stored in a double-length floating point
number. Previously, the mac CDM code would work around this issue by returning the absolute
value of NSError code returned by media frameworks. Instead, fix the underlying problem by
storing the MediaKeyError's systemCode as a uint32_t (which more accurately represents the
size of a WebIDL &quot;unsigned long&quot; on all platforms.)

Check the error code issued by -contentKeyRequestDataForApp:contentIdentifier:options:error:.

* Modules/encryptedmedia/CDM.h:
* Modules/encryptedmedia/CDMSessionClearKey.cpp:
(WebCore::CDMSessionClearKey::generateKeyRequest):
(WebCore::CDMSessionClearKey::update):
* Modules/encryptedmedia/CDMSessionClearKey.h:
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::keyRequestTimerFired):
(WebCore::MediaKeySession::addKeyTimerFired):
(WebCore::MediaKeySession::sendError):
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.handleReadyStateChange):
* WebCore.xcodeproj/project.pbxproj:
* html/MediaKeyError.h:
(WebCore::MediaKeyError::create):
(WebCore::MediaKeyError::systemCode):
* html/MediaKeyEvent.h:
* platform/graphics/CDMSession.h:
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
(WebCore::CDMSessionAVFoundationCF::generateKeyRequest):
(WebCore::CDMSessionAVFoundationCF::update):
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h:
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
(WebCore::CDMSessionAVContentKeySession::update):
(WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
(WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
(WebCore::CDMSessionAVFoundationObjC::update):
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::generateKeyRequest):
(WebCore::CDMSessionAVStreamSession::update):
(WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(WebCore::CDMSessionMediaSourceAVFObjC::layerDidReceiveError):
(WebCore::CDMSessionMediaSourceAVFObjC::rendererDidReceiveError):
(WebCore::CDMSessionMediaSourceAVFObjC::systemCodeForError): Deleted.
* testing/MockCDM.cpp:
(WebCore::MockCDMSession::generateKeyRequest):
(WebCore::MockCDMSession::update):2016-01-15  Simon Fraser  &lt;simon.fraser@apple.com&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMh">trunk/Source/WebCore/Modules/encryptedmedia/CDM.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMSessionClearKeycpp">trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMSessionClearKeyh">trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessioncpp">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessionh">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaKeyErrorh">trunk/Source/WebCore/html/MediaKeyError.h</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaKeyEventh">trunk/Source/WebCore/html/MediaKeyEvent.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsCDMSessionh">trunk/Source/WebCore/platform/graphics/CDMSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationcfCDMSessionAVFoundationCFcpp">trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationcfCDMSessionAVFoundationCFh">trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVContentKeySessionh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVContentKeySessionmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVFoundationObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVFoundationObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVStreamSessionh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVStreamSessionmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm</a></li>
<li><a href="#trunkSourceWebCoretestingMockCDMcpp">trunk/Source/WebCore/testing/MockCDM.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformcocoaWebCoreNSErrorExtrash">trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaWebCoreNSErrorExtrasmm">trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/ChangeLog        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2016-01-21  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [EME] Correctly report errors when generating key requests from AVContentKeySession.
+        https://bugs.webkit.org/show_bug.cgi?id=151963
+
+        Reviewed by Eric Carlson.
+
+        WebIDL's &quot;unsigned long&quot; is a 32-bit unsigned integer, and C++'s &quot;unsigned long&quot; is (or, can
+        be) a 64-bit integer on 64-bit platforms. Casting a negative integer to a 64-bit integer
+        results in a number which cannot be accurately stored in a double-length floating point
+        number. Previously, the mac CDM code would work around this issue by returning the absolute
+        value of NSError code returned by media frameworks. Instead, fix the underlying problem by
+        storing the MediaKeyError's systemCode as a uint32_t (which more accurately represents the
+        size of a WebIDL &quot;unsigned long&quot; on all platforms.)
+
+        Check the error code issued by -contentKeyRequestDataForApp:contentIdentifier:options:error:.
+
+        * Modules/encryptedmedia/CDM.h:
+        * Modules/encryptedmedia/CDMSessionClearKey.cpp:
+        (WebCore::CDMSessionClearKey::generateKeyRequest):
+        (WebCore::CDMSessionClearKey::update):
+        * Modules/encryptedmedia/CDMSessionClearKey.h:
+        * Modules/encryptedmedia/MediaKeySession.cpp:
+        (WebCore::MediaKeySession::keyRequestTimerFired):
+        (WebCore::MediaKeySession::addKeyTimerFired):
+        (WebCore::MediaKeySession::sendError):
+        * Modules/encryptedmedia/MediaKeySession.h:
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.handleReadyStateChange):
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/MediaKeyError.h:
+        (WebCore::MediaKeyError::create):
+        (WebCore::MediaKeyError::systemCode):
+        * html/MediaKeyEvent.h:
+        * platform/graphics/CDMSession.h:
+        * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
+        (WebCore::CDMSessionAVFoundationCF::generateKeyRequest):
+        (WebCore::CDMSessionAVFoundationCF::update):
+        * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h:
+        * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
+        * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
+        (WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
+        (WebCore::CDMSessionAVContentKeySession::update):
+        (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
+        * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
+        (WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
+        (WebCore::CDMSessionAVFoundationObjC::update):
+        * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
+        * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
+        (WebCore::CDMSessionAVStreamSession::generateKeyRequest):
+        (WebCore::CDMSessionAVStreamSession::update):
+        (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+        (WebCore::CDMSessionMediaSourceAVFObjC::layerDidReceiveError):
+        (WebCore::CDMSessionMediaSourceAVFObjC::rendererDidReceiveError):
+        (WebCore::CDMSessionMediaSourceAVFObjC::systemCodeForError): Deleted.
+        * testing/MockCDM.cpp:
+        (WebCore::MockCDMSession::generateKeyRequest):
+        (WebCore::MockCDMSession::update):2016-01-15  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx"> 2016-01-21  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [SOUP] GResource resources should be cached indefinitely in memory cache
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> public:
</span><span class="cx">     explicit CDM(const String&amp; keySystem);
</span><span class="cx"> 
</span><del>-    enum CDMErrorCode { UnknownError = 1, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
</del><ins>+    enum CDMErrorCode { NoError, UnknownError, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
</ins><span class="cx">     static bool supportsKeySystem(const String&amp;);
</span><span class="cx">     static bool keySystemSupportsMimeType(const String&amp; keySystem, const String&amp; mimeType);
</span><span class="cx">     static std::unique_ptr&lt;CDM&gt; create(const String&amp; keySystem);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMSessionClearKeycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Uint8Array&gt; CDMSessionClearKey::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+RefPtr&lt;Uint8Array&gt; CDMSessionClearKey::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(mimeType);
</span><span class="cx">     UNUSED_PARAM(destinationURL);
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">     m_cachedKeys.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CDMSessionClearKey::update(Uint8Array* rawKeysData, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+bool CDMSessionClearKey::update(Uint8Array* rawKeysData, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(nextMessage);
</span><span class="cx">     UNUSED_PARAM(systemCode);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMSessionClearKeyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -42,9 +42,9 @@
</span><span class="cx">     virtual CDMSessionType type() override { return CDMSessionTypeClearKey; }
</span><span class="cx">     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
</span><span class="cx">     virtual const String&amp; sessionId() const override { return m_sessionId; }
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array*, String&amp;, unsigned short&amp;, unsigned long&amp;) override;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array*, String&amp;, unsigned short&amp;, uint32_t&amp;) override;
</ins><span class="cx">     virtual void releaseKeys() override;
</span><del>-    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp;, unsigned short&amp;, unsigned long&amp;) override;
</del><ins>+    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp;, unsigned short&amp;, uint32_t&amp;) override;
</ins><span class="cx">     virtual RefPtr&lt;ArrayBuffer&gt; cachedKeyForKeyID(const String&amp;) const override;
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">         // 2. Let destinationURL be null.
</span><span class="cx">         String destinationURL;
</span><span class="cx">         MediaKeyError::Code errorCode = 0;
</span><del>-        unsigned long systemCode = 0;
</del><ins>+        uint32_t systemCode = 0;
</ins><span class="cx"> 
</span><span class="cx">         // 3. Use cdm to generate a key request and follow the steps for the first matching condition from the following list:
</span><span class="cx"> 
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx">     while (!m_pendingKeys.isEmpty()) {
</span><span class="cx">         RefPtr&lt;Uint8Array&gt; pendingKey = m_pendingKeys.takeFirst();
</span><span class="cx">         unsigned short errorCode = 0;
</span><del>-        unsigned long systemCode = 0;
</del><ins>+        uint32_t systemCode = 0;
</ins><span class="cx"> 
</span><span class="cx">         // NOTE: Continued from step 2. of MediaKeySession::update()
</span><span class="cx">         // 2.1. Let cdm be the cdm loaded in the MediaKeys constructor.
</span><span class="lines">@@ -219,7 +219,7 @@
</span><span class="cx">     m_asyncEventQueue.enqueueEvent(event.release());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaKeySession::sendError(CDMSessionClient::MediaKeyErrorCode errorCode, unsigned long systemCode)
</del><ins>+void MediaKeySession::sendError(CDMSessionClient::MediaKeyErrorCode errorCode, uint32_t systemCode)
</ins><span class="cx"> {
</span><span class="cx">     Ref&lt;MediaKeyError&gt; error = MediaKeyError::create(errorCode, systemCode).get();
</span><span class="cx">     setError(error.ptr());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx"> 
</span><span class="cx">     // CDMSessionClient
</span><span class="cx">     virtual void sendMessage(Uint8Array*, String destinationURL) override;
</span><del>-    virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) override;
</del><ins>+    virtual void sendError(MediaKeyErrorCode, uint32_t systemCode) override;
</ins><span class="cx">     virtual String mediaKeysStorageDirectory() const override;
</span><span class="cx"> 
</span><span class="cx">     MediaKeys* m_keys;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -6067,6 +6067,8 @@
</span><span class="cx">                 CDC8B5AA18047FF10016E685 /* SourceBufferPrivateAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */; };
</span><span class="cx">                 CDC8B5AB18047FF10016E685 /* SourceBufferPrivateAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */; };
</span><span class="cx">                 CDC8B5AD1804AE5D0016E685 /* SourceBufferPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */; };
</span><ins>+                CDC979F41C498C0900DB50D4 /* WebCoreNSErrorExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */; };
+                CDC979F51C498C0900DB50D4 /* WebCoreNSErrorExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */; };
</ins><span class="cx">                 CDCA82961679100F00875714 /* TextTrackRepresentationIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA82941679100F00875714 /* TextTrackRepresentationIOS.mm */; };
</span><span class="cx">                 CDCA98EB18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDCA98EA18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp */; };
</span><span class="cx">                 CDCFABBD18C0AF78006F8450 /* SelectionSubtreeRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCFABBB18C0AE31006F8450 /* SelectionSubtreeRoot.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -13945,6 +13947,8 @@
</span><span class="cx">                 CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SourceBufferPrivateAVFObjC.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivateAVFObjC.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivateClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSErrorExtras.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreNSErrorExtras.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CDCA82941679100F00875714 /* TextTrackRepresentationIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextTrackRepresentationIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDCA98E918B2C8D000C12FF9 /* CDMPrivateMediaPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMPrivateMediaPlayer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDCA98EA18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDMPrivateMediaPlayer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -19746,6 +19750,8 @@
</span><span class="cx">                                 310D71931B335C9D009C7B73 /* ThemeCocoa.cpp */,
</span><span class="cx">                                 310D71941B335C9D009C7B73 /* ThemeCocoa.h */,
</span><span class="cx">                                 46DB7D561B20FE3C005651B2 /* VNodeTrackerCocoa.cpp */,
</span><ins>+                                CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */,
+                                CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = cocoa;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -26633,6 +26639,7 @@
</span><span class="cx">                                 316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */,
</span><span class="cx">                                 BC5EBA110E823E4700B25965 /* KeyframeList.h in Headers */,
</span><span class="cx">                                 E15FF7D518C9553800FE4C87 /* KeypressCommand.h in Headers */,
</span><ins>+                                CDC979F51C498C0900DB50D4 /* WebCoreNSErrorExtras.h in Headers */,
</ins><span class="cx">                                 521D46F811AEC9B100514613 /* KillRing.h in Headers */,
</span><span class="cx">                                 450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */,
</span><span class="cx">                                 A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */,
</span><span class="lines">@@ -28836,6 +28843,7 @@
</span><span class="cx">                                 E16A84F914C85CCC002977DF /* CSSBorderImage.cpp in Sources */,
</span><span class="cx">                                 BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */,
</span><span class="cx">                                 49AE2D8E134EE50C0072920A /* CSSCalculationValue.cpp in Sources */,
</span><ins>+                                CDC979F41C498C0900DB50D4 /* WebCoreNSErrorExtras.mm in Sources */,
</ins><span class="cx">                                 BC604A430DB5634E00204739 /* CSSCanvasValue.cpp in Sources */,
</span><span class="cx">                                 E1EBBBD40AAC9B87001FE8E2 /* CSSCharsetRule.cpp in Sources */,
</span><span class="cx">                                 BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaKeyErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaKeyError.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaKeyError.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/html/MediaKeyError.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -46,10 +46,10 @@
</span><span class="cx">     };
</span><span class="cx">     typedef unsigned short Code;
</span><span class="cx"> 
</span><del>-    static Ref&lt;MediaKeyError&gt; create(Code code, unsigned long systemCode = 0) { return adoptRef(*new MediaKeyError(code, systemCode)); }
</del><ins>+    static Ref&lt;MediaKeyError&gt; create(Code code, uint32_t systemCode = 0) { return adoptRef(*new MediaKeyError(code, systemCode)); }
</ins><span class="cx"> 
</span><span class="cx">     Code code() const { return m_code; }
</span><del>-    unsigned long systemCode() { return m_systemCode; }
</del><ins>+    uint32_t systemCode() { return m_systemCode; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit MediaKeyError(Code code, unsigned long systemCode) : m_code(code), m_systemCode(systemCode) { }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaKeyEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaKeyEvent.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaKeyEvent.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/html/MediaKeyEvent.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     RefPtr&lt;Uint8Array&gt; message;
</span><span class="cx">     String defaultURL;
</span><span class="cx">     RefPtr&lt;MediaKeyError&gt; errorCode;
</span><del>-    unsigned short systemCode;
</del><ins>+    uint32_t systemCode;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class MediaKeyEvent final : public Event {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaWebCoreNSErrorExtrashfromrev195409trunkSourceWebCoreModulesencryptedmediaCDMSessionClearKeyh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h (from rev 195409, trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h) (0 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h                                (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * 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
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaWebCoreNSErrorExtrasmmfromrev195409trunkSourceWebCoreModulesencryptedmediaCDMSessionClearKeyh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm (from rev 195409, trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h) (0 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/WebCoreNSErrorExtras.mm        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#import &quot;WebCoreNSErrorExtras.h&quot;
+
+#import &lt;AVFoundation/AVError.h&gt;
+
+namespace WebCore {
+
+long mediaKeyErrorSystemCode(NSError *error)
+{
+    NSInteger code = [error code];
+
+    if (code == AVErrorUnknown) {
+        NSError* underlyingError = [error.userInfo valueForKey:NSUnderlyingErrorKey];
+        if (underlyingError &amp;&amp; [underlyingError isKindOfClass:[NSError class]])
+            return [underlyingError code];
+    }
+
+    return code;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsCDMSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/CDMSession.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/CDMSession.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/CDMSession.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">         MediaKeyErrorDomain,
</span><span class="cx">     };
</span><span class="cx">     typedef unsigned short MediaKeyErrorCode;
</span><del>-    virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) = 0;
</del><ins>+    virtual void sendError(MediaKeyErrorCode, uint32_t systemCode) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual String mediaKeysStorageDirectory() const = 0;
</span><span class="cx"> };
</span><span class="lines">@@ -70,9 +70,9 @@
</span><span class="cx">     virtual CDMSessionType type() { return CDMSessionTypeUnknown; }
</span><span class="cx">     virtual void setClient(CDMSessionClient*) = 0;
</span><span class="cx">     virtual const String&amp; sessionId() const = 0;
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode) = 0;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode) = 0;
</ins><span class="cx">     virtual void releaseKeys() = 0;
</span><del>-    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode) = 0;
</del><ins>+    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode) = 0;
</ins><span class="cx">     virtual RefPtr&lt;ArrayBuffer&gt; cachedKeyForKeyID(const String&amp;) const { return nullptr; }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationcfCDMSessionAVFoundationCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Uint8Array&gt; CDMSessionAVFoundationCF::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+RefPtr&lt;Uint8Array&gt; CDMSessionAVFoundationCF::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(mimeType);
</span><span class="cx"> 
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CDMSessionAVFoundationCF::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+bool CDMSessionAVFoundationCF::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;CFMutableDataRef&gt; keyData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, key-&gt;byteLength()));
</span><span class="cx">     CFDataAppendBytes(keyData.get(), reinterpret_cast&lt;const UInt8*&gt;(key-&gt;baseAddress()), key-&gt;byteLength());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationcfCDMSessionAVFoundationCFh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
</span><span class="cx">     virtual const String&amp; sessionId() const override { return m_sessionId; }
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx">     virtual void releaseKeys() override;
</span><del>-    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     MediaPlayerPrivateAVFoundationCF* m_parent;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVContentKeySessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -49,9 +49,9 @@
</span><span class="cx"> 
</span><span class="cx">     // CDMSession
</span><span class="cx">     virtual CDMSessionType type() override { return CDMSessionTypeAVContentKeySession; }
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx">     virtual void releaseKeys() override;
</span><del>-    virtual bool update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual bool update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx"> 
</span><span class="cx">     // CDMSessionMediaSourceAVFObjC
</span><span class="cx">     void addParser(AVStreamDataParser *) override;
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">     void didProvideContentKeyRequest(AVContentKeyRequest *);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    PassRefPtr&lt;Uint8Array&gt; generateKeyReleaseMessage(unsigned short&amp; errorCode, unsigned long&amp; systemCode);
</del><ins>+    PassRefPtr&lt;Uint8Array&gt; generateKeyReleaseMessage(unsigned short&amp; errorCode, uint32_t&amp; systemCode);
</ins><span class="cx"> 
</span><span class="cx">     bool hasContentKeySession() const { return m_contentKeySession; }
</span><span class="cx">     AVContentKeySession* contentKeySession();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVContentKeySessionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -37,9 +37,9 @@
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="cx"> #import &quot;SourceBufferPrivateAVFObjC.h&quot;
</span><span class="cx"> #import &quot;UUID.h&quot;
</span><ins>+#import &quot;WebCoreNSErrorExtras.h&quot;
</ins><span class="cx"> #import &lt;AVFoundation/AVError.h&gt;
</span><span class="cx"> #import &lt;CoreMedia/CMBase.h&gt;
</span><del>-#import &lt;cstdlib&gt;
</del><span class="cx"> #import &lt;objc/objc-runtime.h&gt;
</span><span class="cx"> #import &lt;runtime/TypedArrayInlines.h&gt;
</span><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">     return getAVContentKeySessionClass();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Uint8Array&gt; CDMSessionAVContentKeySession::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+RefPtr&lt;Uint8Array&gt; CDMSessionAVContentKeySession::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(mimeType);
</span><span class="cx">     UNUSED_PARAM(destinationURL);
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">     return !literal[length];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CDMSessionAVContentKeySession::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+bool CDMSessionAVContentKeySession::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(nextMessage);
</span><span class="cx"> 
</span><span class="lines">@@ -281,9 +281,15 @@
</span><span class="cx"> 
</span><span class="cx">         errorCode = MediaPlayer::NoError;
</span><span class="cx">         systemCode = 0;
</span><del>-        NSData* requestData = [m_keyRequest contentKeyRequestDataForApp:certificateData.get() contentIdentifier:nil options:options.get() error:nil];
</del><ins>+        NSError* error = nil;
+        NSData* requestData = [m_keyRequest contentKeyRequestDataForApp:certificateData.get() contentIdentifier:nil options:options.get() error:&amp;error];
+        if (error) {
+            errorCode = MediaPlayerClient::DomainError;
+            systemCode = mediaKeyErrorSystemCode(error);
+            return false;
+        }
+
</ins><span class="cx">         nextMessage = Uint8Array::create(static_cast&lt;const uint8_t*&gt;([requestData bytes]), [requestData length]);
</span><del>-
</del><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -306,7 +312,7 @@
</span><span class="cx">     [contentKeySession() removeStreamDataParser:parser];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Uint8Array&gt; CDMSessionAVContentKeySession::generateKeyReleaseMessage(unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+PassRefPtr&lt;Uint8Array&gt; CDMSessionAVContentKeySession::generateKeyReleaseMessage(unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_mode == KeyRelease);
</span><span class="cx">     m_certificate = m_initData;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -45,9 +45,9 @@
</span><span class="cx">     virtual CDMSessionType type() override { return CDMSessionTypeAVFoundationObjC; }
</span><span class="cx">     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
</span><span class="cx">     virtual const String&amp; sessionId() const override { return m_sessionId; }
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx">     virtual void releaseKeys() override;
</span><del>-    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     MediaPlayerPrivateAVFoundationObjC* m_parent;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #import &quot;MediaPlayerPrivateAVFoundationObjC.h&quot;
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="cx"> #import &quot;UUID.h&quot;
</span><ins>+#import &quot;WebCoreNSErrorExtras.h&quot;
</ins><span class="cx"> #import &lt;AVFoundation/AVFoundation.h&gt;
</span><span class="cx"> #import &lt;objc/objc-runtime.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -53,7 +54,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Uint8Array&gt; CDMSessionAVFoundationObjC::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+RefPtr&lt;Uint8Array&gt; CDMSessionAVFoundationObjC::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(mimeType);
</span><span class="cx"> 
</span><span class="lines">@@ -61,13 +62,13 @@
</span><span class="cx">     String keyID;
</span><span class="cx">     RefPtr&lt;Uint8Array&gt; certificate;
</span><span class="cx">     if (!MediaPlayerPrivateAVFoundationObjC::extractKeyURIKeyIDAndCertificateFromInitData(initData, keyURI, keyID, certificate)) {
</span><del>-        errorCode = MediaPlayer::InvalidPlayerState;
</del><ins>+        errorCode = CDM::UnknownError;
</ins><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_request = m_parent-&gt;takeRequestForKeyURI(keyURI);
</span><span class="cx">     if (!m_request) {
</span><del>-        errorCode = MediaPlayer::InvalidPlayerState;
</del><ins>+        errorCode = CDM::UnknownError;
</ins><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -78,8 +79,8 @@
</span><span class="cx">     RetainPtr&lt;NSData&gt; keyRequest = [m_request streamingContentKeyRequestDataForApp:certificateData.get() contentIdentifier:assetID.get() options:nil error:&amp;nsError];
</span><span class="cx"> 
</span><span class="cx">     if (!keyRequest) {
</span><del>-        NSError* underlyingError = [[nsError userInfo] objectForKey:NSUnderlyingErrorKey];
-        systemCode = [underlyingError code];
</del><ins>+        errorCode = CDM::DomainError;
+        systemCode = mediaKeyErrorSystemCode(nsError);
</ins><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -95,7 +96,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CDMSessionAVFoundationObjC::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+bool CDMSessionAVFoundationObjC::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSData&gt; keyData = adoptNS([[NSData alloc] initWithBytes:key-&gt;baseAddress() length:key-&gt;byteLength()]);
</span><span class="cx">     [[m_request dataRequest] respondWithData:keyData.get()];
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVStreamSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -47,9 +47,9 @@
</span><span class="cx"> 
</span><span class="cx">     // CDMSession
</span><span class="cx">     virtual CDMSessionType type() override { return CDMSessionTypeAVStreamSession; }
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx">     virtual void releaseKeys() override;
</span><del>-    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx"> 
</span><span class="cx">     // CDMSessionMediaSourceAVFObjC
</span><span class="cx">     void addParser(AVStreamDataParser*) override;
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     void setStreamSession(AVStreamSession*);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    PassRefPtr&lt;Uint8Array&gt; generateKeyReleaseMessage(unsigned short&amp; errorCode, unsigned long&amp; systemCode);
</del><ins>+    PassRefPtr&lt;Uint8Array&gt; generateKeyReleaseMessage(unsigned short&amp; errorCode, uint32_t systemCode);
</ins><span class="cx"> 
</span><span class="cx">     WeakPtrFactory&lt;CDMSessionAVStreamSession&gt; m_weakPtrFactory;
</span><span class="cx">     RetainPtr&lt;AVStreamSession&gt; m_streamSession;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVStreamSessionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -37,9 +37,9 @@
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="cx"> #import &quot;SourceBufferPrivateAVFObjC.h&quot;
</span><span class="cx"> #import &quot;UUID.h&quot;
</span><ins>+#import &quot;WebCoreNSErrorExtras.h&quot;
</ins><span class="cx"> #import &lt;AVFoundation/AVError.h&gt;
</span><span class="cx"> #import &lt;CoreMedia/CMBase.h&gt;
</span><del>-#import &lt;cstdlib&gt;
</del><span class="cx"> #import &lt;objc/objc-runtime.h&gt;
</span><span class="cx"> #import &lt;runtime/TypedArrayInlines.h&gt;
</span><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">         removeParser(sourceBuffer-&gt;parser());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Uint8Array&gt; CDMSessionAVStreamSession::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+RefPtr&lt;Uint8Array&gt; CDMSessionAVStreamSession::generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(mimeType);
</span><span class="cx">     UNUSED_PARAM(destinationURL);
</span><span class="lines">@@ -187,7 +187,7 @@
</span><span class="cx">     return !literal[length];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CDMSessionAVStreamSession::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+bool CDMSessionAVStreamSession::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode)
</ins><span class="cx"> {
</span><span class="cx">     bool shouldGenerateKeyRequest = !m_certificate || isEqual(key, &quot;renew&quot;);
</span><span class="cx">     if (!m_certificate) {
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx">         if (error) {
</span><span class="cx">             LOG(Media, &quot;CDMSessionAVStreamSession::update(%p) - error:%@&quot;, this, [error description]);
</span><span class="cx">             errorCode = MediaPlayer::InvalidPlayerState;
</span><del>-            systemCode = std::abs(systemCodeForError(error));
</del><ins>+            systemCode = mediaKeyErrorSystemCode(error);
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx">         [m_streamSession removeStreamDataParser:parser];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Uint8Array&gt; CDMSessionAVStreamSession::generateKeyReleaseMessage(unsigned short&amp; errorCode, unsigned long&amp; systemCode)
</del><ins>+PassRefPtr&lt;Uint8Array&gt; CDMSessionAVStreamSession::generateKeyReleaseMessage(unsigned short&amp; errorCode, uint32_t systemCode)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_mode == KeyRelease);
</span><span class="cx">     m_certificate = m_initData;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -63,7 +63,6 @@
</span><span class="cx">     void invalidateCDM() { m_cdm = nullptr; }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    static long systemCodeForError(NSError *);
</del><span class="cx">     String storagePath() const;
</span><span class="cx"> 
</span><span class="cx">     CDMPrivateMediaSourceAVFObjC* m_cdm;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -30,8 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;CDMPrivateMediaSourceAVFObjC.h&quot;
</span><span class="cx"> #import &quot;FileSystem.h&quot;
</span><ins>+#import &quot;WebCoreNSErrorExtras.h&quot;
</ins><span class="cx"> #import &lt;AVFoundation/AVError.h&gt;
</span><del>-#import &lt;cstdlib&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx">     if (!m_client)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned long code = std::abs(systemCodeForError(error));
</del><ins>+    unsigned long code = mediaKeyErrorSystemCode(error);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME(142246): Remove the following once &lt;rdar://problem/20027434&gt; is resolved.
</span><span class="cx">     shouldIgnore = m_stopped &amp;&amp; code == 12785;
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">     if (!m_client)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned long code = std::abs(systemCodeForError(error));
</del><ins>+    unsigned long code = mediaKeyErrorSystemCode(error);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME(142246): Remove the following once &lt;rdar://problem/20027434&gt; is resolved.
</span><span class="cx">     shouldIgnore = m_stopped &amp;&amp; code == 12785;
</span><span class="lines">@@ -96,19 +96,6 @@
</span><span class="cx">     m_sourceBuffers.remove(m_sourceBuffers.find(sourceBuffer));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-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];
-}
-
</del><span class="cx"> String CDMSessionMediaSourceAVFObjC::storagePath() const
</span><span class="cx"> {
</span><span class="cx">     return m_client ? pathByAppendingComponent(m_client-&gt;mediaKeysStorageDirectory(), &quot;SecureStop.plist&quot;) : emptyString();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockCDMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockCDM.cpp (195409 => 195410)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockCDM.cpp        2016-01-21 15:47:31 UTC (rev 195409)
+++ trunk/Source/WebCore/testing/MockCDM.cpp        2016-01-21 17:15:16 UTC (rev 195410)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setClient(CDMSessionClient* client) override { m_client = client; }
</span><span class="cx">     virtual const String&amp; sessionId() const override { return m_sessionId; }
</span><del>-    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual RefPtr&lt;Uint8Array&gt; generateKeyRequest(const String&amp; mimeType, Uint8Array* initData, String&amp; destinationURL, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx">     virtual void releaseKeys() override;
</span><del>-    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, unsigned long&amp; systemCode) override;
</del><ins>+    virtual bool update(Uint8Array*, RefPtr&lt;Uint8Array&gt;&amp; nextMessage, unsigned short&amp; errorCode, uint32_t&amp; systemCode) override;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     CDMSessionClient* m_client;
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Uint8Array&gt; MockCDMSession::generateKeyRequest(const String&amp;, Uint8Array* initData, String&amp;, unsigned short&amp; errorCode, unsigned long&amp;)
</del><ins>+RefPtr&lt;Uint8Array&gt; MockCDMSession::generateKeyRequest(const String&amp;, Uint8Array* initData, String&amp;, unsigned short&amp; errorCode, uint32_t&amp;)
</ins><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0; i &lt; initDataPrefix()-&gt;length(); ++i) {
</span><span class="cx">         if (!initData || i &gt;= initData-&gt;length() || initData-&gt;item(i) != initDataPrefix()-&gt;item(i)) {
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">     // no-op
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MockCDMSession::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp;, unsigned short&amp; errorCode, unsigned long&amp;)
</del><ins>+bool MockCDMSession::update(Uint8Array* key, RefPtr&lt;Uint8Array&gt;&amp;, unsigned short&amp; errorCode, uint32_t&amp;)
</ins><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0; i &lt; keyPrefix()-&gt;length(); ++i) {
</span><span class="cx">         if (i &gt;= key-&gt;length() || key-&gt;item(i) != keyPrefix()-&gt;item(i)) {
</span></span></pre>
</div>
</div>

</body>
</html>