| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return m_clients; | 119 return m_clients; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState) | 122 void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState) |
| 123 { | 123 { |
| 124 exceptionState.throwDOMException(InvalidAccessError, "Not supported."); | 124 exceptionState.throwDOMException(InvalidAccessError, "Not supported."); |
| 125 } | 125 } |
| 126 | 126 |
| 127 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* scriptState) | 127 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* scriptState) |
| 128 { | 128 { |
| 129 ExecutionContext* executionContext = scriptState->executionContext(); |
| 130 // FIXME: short-term fix, see details at: https://codereview.chromium.org/53
5193002/. |
| 131 if (!executionContext) |
| 132 return ScriptPromise(); |
| 133 |
| 129 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 134 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
| 130 ScriptPromise promise = resolver->promise(); | 135 ScriptPromise promise = resolver->promise(); |
| 131 | 136 |
| 132 ExecutionContext* executionContext = scriptState->executionContext(); | |
| 133 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip
WaitingCallback(resolver)); | 137 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip
WaitingCallback(resolver)); |
| 134 return promise; | 138 return promise; |
| 135 } | 139 } |
| 136 | 140 |
| 137 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P
assRefPtr<EventListener> listener, bool useCapture) | 141 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P
assRefPtr<EventListener> listener, bool useCapture) |
| 138 { | 142 { |
| 139 if (m_didEvaluateScript) { | 143 if (m_didEvaluateScript) { |
| 140 if (eventType == EventTypeNames::install) { | 144 if (eventType == EventTypeNames::install) { |
| 141 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, "Event handler of 'install' event m
ust be added on the initial evaluation of worker script."); | 145 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, WarningMessageLevel, "Event handler of 'install' event m
ust be added on the initial evaluation of worker script."); |
| 142 addMessageToWorkerConsole(consoleMessage.release()); | 146 addMessageToWorkerConsole(consoleMessage.release()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtrWillBeRawPtr<ScriptCallStack> callStack) | 197 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtrWillBeRawPtr<ScriptCallStack> callStack) |
| 194 { | 198 { |
| 195 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); | 199 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); |
| 196 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); | 200 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); |
| 197 consoleMessage->setScriptId(scriptId); | 201 consoleMessage->setScriptId(scriptId); |
| 198 consoleMessage->setCallStack(callStack); | 202 consoleMessage->setCallStack(callStack); |
| 199 addMessageToWorkerConsole(consoleMessage.release()); | 203 addMessageToWorkerConsole(consoleMessage.release()); |
| 200 } | 204 } |
| 201 | 205 |
| 202 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |