OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // FIXME: Can we even get here during initialization now that we bail out when | 155 // FIXME: Can we even get here during initialization now that we bail out when |
156 // GetEntered returns an empty handle? | 156 // GetEntered returns an empty handle? |
157 if (context->isDocument()) { | 157 if (context->isDocument()) { |
158 LocalFrame* frame = toDocument(context)->frame(); | 158 LocalFrame* frame = toDocument(context)->frame(); |
159 if (frame && frame->script().existingWindowProxy(scriptState->world())) { | 159 if (frame && frame->script().existingWindowProxy(scriptState->world())) { |
160 V8ErrorHandler::storeExceptionOnErrorEventWrapper( | 160 V8ErrorHandler::storeExceptionOnErrorEventWrapper( |
161 scriptState, event, data, scriptState->context()->Global()); | 161 scriptState, event, data, scriptState->context()->Global()); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 if (scriptState->world().isPrivateScriptIsolatedWorld()) { | 165 context->dispatchErrorEvent(event, accessControlStatus); |
166 // We allow a private script to dispatch error events even in a | |
167 // EventDispatchForbiddenScope scope. Without having this ability, it's | |
168 // hard to debug the private script because syntax errors in the private | |
169 // script are not reported to console (the private script just crashes | |
170 // silently). Allowing error events in private scripts is safe because | |
171 // error events don't propagate to other isolated worlds (which means that | |
172 // the error events won't fire any event listeners in user's scripts). | |
173 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; | |
174 context->dispatchErrorEvent(event, accessControlStatus); | |
175 } else { | |
176 context->dispatchErrorEvent(event, accessControlStatus); | |
177 } | |
178 } | 166 } |
179 | 167 |
180 namespace { | 168 namespace { |
181 | 169 |
182 static RejectedPromises& rejectedPromisesOnMainThread() { | 170 static RejectedPromises& rejectedPromisesOnMainThread() { |
183 ASSERT(isMainThread()); | 171 ASSERT(isMainThread()); |
184 DEFINE_STATIC_LOCAL(RefPtr<RejectedPromises>, rejectedPromises, | 172 DEFINE_STATIC_LOCAL(RefPtr<RejectedPromises>, rejectedPromises, |
185 (RejectedPromises::create())); | 173 (RejectedPromises::create())); |
186 return *rejectedPromises; | 174 return *rejectedPromises; |
187 } | 175 } |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 isolate->AddMessageListener(messageHandlerInWorker); | 479 isolate->AddMessageListener(messageHandlerInWorker); |
492 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 480 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
493 | 481 |
494 uint32_t here; | 482 uint32_t here; |
495 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - | 483 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - |
496 kWorkerMaxStackSize); | 484 kWorkerMaxStackSize); |
497 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 485 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
498 } | 486 } |
499 | 487 |
500 } // namespace blink | 488 } // namespace blink |
OLD | NEW |