ScriptPromise HTMLMediaElementEncryptedMedia::setMediaKeys(ScriptState* scriptState, HTMLMediaElement& element, MediaKeys* mediaKeys) { HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia::from(element); WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::setMediaKeys current(%p), new(%p)", thisElement.m_mediaKeys.get(), mediaKeys); if (!thisElement.setEmeMode(EmeModeUnprefixed)) return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Mixed use of EME prefixed and unprefixed API not allowed.")); // 1. If mediaKeys and the mediaKeys attribute are the same object, return // a promise resolved with undefined. if (thisElement.m_mediaKeys == mediaKeys) return ScriptPromise::cast(scriptState, V8ValueTraits<V8UndefinedType>::toV8Value(V8UndefinedType(), scriptState->context()->Global(), scriptState->isolate())); // 2. Let promise be a new promise. Remaining steps done in handler. return SetMediaKeysHandler::create(scriptState, element, mediaKeys); }
static V8UndefinedType from(ScriptPromiseResolverWithContext* resolver, WebServiceWorker* worker) { ASSERT(!worker); // Anything passed here will be leaked. return V8UndefinedType(); }