| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void ServiceWorkerGlobalScope::setRegistration(std::unique_ptr<WebServiceWorkerR
egistration::Handle> handle) | 153 void ServiceWorkerGlobalScope::setRegistration(std::unique_ptr<WebServiceWorkerR
egistration::Handle> handle) |
| 154 { | 154 { |
| 155 if (!getExecutionContext()) | 155 if (!getExecutionContext()) |
| 156 return; | 156 return; |
| 157 m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(
), wrapUnique(handle.release())); | 157 m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(
), wrapUnique(handle.release())); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& even
tType, EventListener* listener, const AddEventListenerOptionsResolved& options) | 160 bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& even
tType, EventListener* listener, const AddEventListenerOptionsResolved& options) |
| 161 { | 161 { |
| 162 if (m_didEvaluateScript) { | 162 if (m_didEvaluateScript) { |
| 163 if (eventType == EventTypeNames::install) { | 163 String message = String::format("Event handler of '%s' event must be add
ed on the initial evaluation of worker script.", eventType.utf8().data()); |
| 164 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSou
rce, WarningMessageLevel, "Event handler of 'install' event must be added on the
initial evaluation of worker script."); | 164 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage
Level, message)); |
| 165 addConsoleMessage(consoleMessage); | |
| 166 } else if (eventType == EventTypeNames::activate) { | |
| 167 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSou
rce, WarningMessageLevel, "Event handler of 'activate' event must be added on th
e initial evaluation of worker script."); | |
| 168 addConsoleMessage(consoleMessage); | |
| 169 } | |
| 170 } | 165 } |
| 171 return WorkerGlobalScope::addEventListenerInternal(eventType, listener, opti
ons); | 166 return WorkerGlobalScope::addEventListenerInternal(eventType, listener, opti
ons); |
| 172 } | 167 } |
| 173 | 168 |
| 174 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const | 169 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const |
| 175 { | 170 { |
| 176 return EventTargetNames::ServiceWorkerGlobalScope; | 171 return EventTargetNames::ServiceWorkerGlobalScope; |
| 177 } | 172 } |
| 178 | 173 |
| 179 DispatchEventResult ServiceWorkerGlobalScope::dispatchEventInternal(Event* event
) | 174 DispatchEventResult ServiceWorkerGlobalScope::dispatchEventInternal(Event* event
) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 220 } |
| 226 | 221 |
| 227 void ServiceWorkerGlobalScope::exceptionThrown(ErrorEvent* event) | 222 void ServiceWorkerGlobalScope::exceptionThrown(ErrorEvent* event) |
| 228 { | 223 { |
| 229 WorkerGlobalScope::exceptionThrown(event); | 224 WorkerGlobalScope::exceptionThrown(event); |
| 230 if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(thread()->is
olate())) | 225 if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(thread()->is
olate())) |
| 231 debugger->exceptionThrown(event); | 226 debugger->exceptionThrown(event); |
| 232 } | 227 } |
| 233 | 228 |
| 234 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |