bool Event::legacyReturnValue(ExecutionContext* executionContext) const { bool returnValue = !defaultPrevented(); if (returnValue) UseCounter::count(executionContext, UseCounter::EventGetReturnValueTrue); else UseCounter::count(executionContext, UseCounter::EventGetReturnValueFalse); return returnValue; }
ScriptPromise BeforeInstallPromptEvent::prompt(ScriptState* scriptState) { // |m_registered| will be true if userChoice has already been accessed // or prompt() has already been called. Return a rejected promise in both // these cases, as well as if we have a null client or invalid requestId. if (m_registered || !defaultPrevented() || !m_client || m_requestId == -1) return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "The prompt() method may only be called once, following preventDefault().")); m_registered = true; m_client->registerBannerCallbacks(m_requestId, new AppBannerCallbacks(m_userChoice.get())); m_client->showAppBanner(m_requestId); return ScriptPromise::castUndefined(scriptState); }