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

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

Issue 111373003: Migrate bindings constructors to the new ExceptionState model. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/events/MessageEvent.cpp ('k') | Source/core/workers/SharedWorker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 AbstractWorker::~AbstractWorker() 47 AbstractWorker::~AbstractWorker()
48 { 48 {
49 } 49 }
50 50
51 KURL AbstractWorker::resolveURL(const String& url, ExceptionState& exceptionStat e) 51 KURL AbstractWorker::resolveURL(const String& url, ExceptionState& exceptionStat e)
52 { 52 {
53 // FIXME: This should use the dynamic global scope (bug #27887) 53 // FIXME: This should use the dynamic global scope (bug #27887)
54 KURL scriptURL = executionContext()->completeURL(url); 54 KURL scriptURL = executionContext()->completeURL(url);
55 if (!scriptURL.isValid()) { 55 if (!scriptURL.isValid()) {
56 exceptionState.throwDOMException(SyntaxError, "Failed to create a worker : '" + url + "' is not a valid URL."); 56 exceptionState.throwDOMException(SyntaxError, "'" + url + "' is not a va lid URL.");
57 return KURL(); 57 return KURL();
58 } 58 }
59 59
60 // We can safely expose the URL in the following exceptions, as these checks happen synchronously before redirection. JavaScript receives no new information . 60 // We can safely expose the URL in the following exceptions, as these checks happen synchronously before redirection. JavaScript receives no new information .
61 if (!executionContext()->securityOrigin()->canRequest(scriptURL)) { 61 if (!executionContext()->securityOrigin()->canRequest(scriptURL)) {
62 exceptionState.throwSecurityError("Failed to create a worker: script at '" + scriptURL.elidedString() + "' cannot be accessed from origin '" + execution Context()->securityOrigin()->toString() + "'."); 62 exceptionState.throwSecurityError("Script at '" + scriptURL.elidedString () + "' cannot be accessed from origin '" + executionContext()->securityOrigin() ->toString() + "'.");
63 return KURL(); 63 return KURL();
64 } 64 }
65 65
66 if (executionContext()->contentSecurityPolicy() && !executionContext()->cont entSecurityPolicy()->allowScriptFromSource(scriptURL)) { 66 if (executionContext()->contentSecurityPolicy() && !executionContext()->cont entSecurityPolicy()->allowScriptFromSource(scriptURL)) {
67 exceptionState.throwSecurityError("Failed to create a worker: access to the script at '" + scriptURL.elidedString() + "' is denied by the document's Con tent Security Policy."); 67 exceptionState.throwSecurityError("Access to the script at '" + scriptUR L.elidedString() + "' is denied by the document's Content Security Policy.");
68 return KURL(); 68 return KURL();
69 } 69 }
70 70
71 return scriptURL; 71 return scriptURL;
72 } 72 }
73 73
74 } // namespace WebCore 74 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/events/MessageEvent.cpp ('k') | Source/core/workers/SharedWorker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698