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 if (!executionContext) | |
131 return ScriptPromise(); | |
falken
2015/01/08 04:31:52
I have some questions.
1. What happens if Termina
xiang
2015/01/08 08:16:13
I'm not sure about it in this case, from my code r
falken
2015/01/08 08:28:05
I see! That looks right.
| |
132 | |
129 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); | 133 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); |
130 ScriptPromise promise = resolver->promise(); | 134 ScriptPromise promise = resolver->promise(); |
131 | 135 |
132 ExecutionContext* executionContext = scriptState->executionContext(); | |
133 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip WaitingCallback(resolver)); | 136 ServiceWorkerGlobalScopeClient::from(executionContext)->skipWaiting(new Skip WaitingCallback(resolver)); |
134 return promise; | 137 return promise; |
135 } | 138 } |
136 | 139 |
137 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P assRefPtr<EventListener> listener, bool useCapture) | 140 bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, P assRefPtr<EventListener> listener, bool useCapture) |
138 { | 141 { |
139 if (m_didEvaluateScript) { | 142 if (m_didEvaluateScript) { |
140 if (eventType == EventTypeNames::install) { | 143 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."); | 144 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()); | 145 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) | 196 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) |
194 { | 197 { |
195 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); | 198 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); |
196 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); | 199 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); |
197 consoleMessage->setScriptId(scriptId); | 200 consoleMessage->setScriptId(scriptId); |
198 consoleMessage->setCallStack(callStack); | 201 consoleMessage->setCallStack(callStack); |
199 addMessageToWorkerConsole(consoleMessage.release()); | 202 addMessageToWorkerConsole(consoleMessage.release()); |
200 } | 203 } |
201 | 204 |
202 } // namespace blink | 205 } // namespace blink |
OLD | NEW |