Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState) 199 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState & exceptionState)
200 { 200 {
201 ASSERT(contentSecurityPolicy()); 201 ASSERT(contentSecurityPolicy());
202 Vector<String>::const_iterator urlsEnd = urls.end(); 202 Vector<String>::const_iterator urlsEnd = urls.end();
203 Vector<KURL> completedURLs; 203 Vector<KURL> completedURLs;
204 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { 204 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) {
205 const KURL& url = executionContext()->completeURL(*it); 205 const KURL& url = executionContext()->completeURL(*it);
206 if (!url.isValid()) { 206 if (!url.isValid()) {
207 exceptionState.throwDOMException(SyntaxError, "Failed to execute 'im portScripts': the URL '" + *it + "' is invalid."); 207 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "' is invalid.");
208 return; 208 return;
209 } 209 }
210 completedURLs.append(url); 210 completedURLs.append(url);
211 } 211 }
212 Vector<KURL>::const_iterator end = completedURLs.end(); 212 Vector<KURL>::const_iterator end = completedURLs.end();
213 213
214 for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++i t) { 214 for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++i t) {
215 RefPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::create()); 215 RefPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::create());
216 scriptLoader->setTargetType(ResourceRequest::TargetIsScript); 216 scriptLoader->setTargetType(ResourceRequest::TargetIsScript);
217 scriptLoader->loadSynchronously(executionContext(), *it, AllowCrossOrigi nRequests); 217 scriptLoader->loadSynchronously(executionContext(), *it, AllowCrossOrigi nRequests);
218 218
219 // If the fetching attempt failed, throw a NetworkError exception and ab ort all these steps. 219 // If the fetching attempt failed, throw a NetworkError exception and ab ort all these steps.
220 if (scriptLoader->failed()) { 220 if (scriptLoader->failed()) {
221 exceptionState.throwDOMException(NetworkError, "Failed to execute 'i mportScripts': the script at '" + it->elidedString() + "' failed to load."); 221 exceptionState.throwDOMException(NetworkError, "The script at '" + i t->elidedString() + "' failed to load.");
222 return; 222 return;
223 } 223 }
224 224
225 InspectorInstrumentation::scriptImported(executionContext(), scriptLoade r->identifier(), scriptLoader->script()); 225 InspectorInstrumentation::scriptImported(executionContext(), scriptLoade r->identifier(), scriptLoader->script());
226 226
227 RefPtr<ErrorEvent> errorEvent; 227 RefPtr<ErrorEvent> errorEvent;
228 m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader ->responseURL()), &errorEvent); 228 m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader ->responseURL()), &errorEvent);
229 if (errorEvent) { 229 if (errorEvent) {
230 m_script->rethrowExceptionFromImportedScript(errorEvent.release()); 230 m_script->rethrowExceptionFromImportedScript(errorEvent.release());
231 return; 231 return;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 { 328 {
329 return script()->idleNotification(); 329 return script()->idleNotification();
330 } 330 }
331 331
332 WorkerEventQueue* WorkerGlobalScope::eventQueue() const 332 WorkerEventQueue* WorkerGlobalScope::eventQueue() const
333 { 333 {
334 return m_eventQueue.get(); 334 return m_eventQueue.get();
335 } 335 }
336 336
337 } // namespace WebCore 337 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/chromium/ChromiumDataObject.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698