OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 scriptState, DOMException::create(InvalidAccessError, "The serverCer
tificate parameter is empty.")); | 144 scriptState, DOMException::create(InvalidAccessError, "The serverCer
tificate parameter is empty.")); |
145 } | 145 } |
146 | 146 |
147 // 2. If the keySystem does not support server certificates, return a | 147 // 2. If the keySystem does not support server certificates, return a |
148 // promise rejected with a new DOMException whose name is | 148 // promise rejected with a new DOMException whose name is |
149 // "NotSupportedError". | 149 // "NotSupportedError". |
150 // (Let the CDM decide whether to support this or not.) | 150 // (Let the CDM decide whether to support this or not.) |
151 | 151 |
152 // 3. Let certificate be a copy of the contents of the serverCertificate | 152 // 3. Let certificate be a copy of the contents of the serverCertificate |
153 // parameter. | 153 // parameter. |
154 RefPtr<DOMArrayBuffer> serverCertificateBuffer = DOMArrayBuffer::create(serv
erCertificate.data(), serverCertificate.byteLength()); | 154 // |
| 155 // TODO(junov): crbug.com/536816 |
| 156 // Use createOrNull instead of deprecatedCreateOrCrash. It would probably |
| 157 // be appropriate to reject the promise with a RangeError exception when |
| 158 // array buffer allocation fails, but that behavior probably needs |
| 159 // clarification in the spec. |
| 160 RefPtr<DOMArrayBuffer> serverCertificateBuffer = DOMArrayBuffer::deprecatedC
reateOrCrash(serverCertificate.data(), serverCertificate.byteLength()); |
155 | 161 |
156 // 4. Let promise be a new promise. | 162 // 4. Let promise be a new promise. |
157 SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryp
tionModuleResultPromise(scriptState); | 163 SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryp
tionModuleResultPromise(scriptState); |
158 ScriptPromise promise = result->promise(); | 164 ScriptPromise promise = result->promise(); |
159 | 165 |
160 // 5. Run the following steps asynchronously (documented in timerFired()). | 166 // 5. Run the following steps asynchronously (documented in timerFired()). |
161 m_pendingActions.append(PendingAction::CreatePendingSetServerCertificate(res
ult, serverCertificateBuffer.release())); | 167 m_pendingActions.append(PendingAction::CreatePendingSetServerCertificate(res
ult, serverCertificateBuffer.release())); |
162 if (!m_timer.isActive()) | 168 if (!m_timer.isActive()) |
163 m_timer.startOneShot(0, BLINK_FROM_HERE); | 169 m_timer.startOneShot(0, BLINK_FROM_HERE); |
164 | 170 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 void MediaKeys::stop() | 270 void MediaKeys::stop() |
265 { | 271 { |
266 ActiveDOMObject::stop(); | 272 ActiveDOMObject::stop(); |
267 | 273 |
268 if (m_timer.isActive()) | 274 if (m_timer.isActive()) |
269 m_timer.stop(); | 275 m_timer.stop(); |
270 m_pendingActions.clear(); | 276 m_pendingActions.clear(); |
271 } | 277 } |
272 | 278 |
273 } // namespace blink | 279 } // namespace blink |
OLD | NEW |