WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
27770
Workers need to throw an exception when presented with invalid URLs
https://bugs.webkit.org/show_bug.cgi?id=27770
Summary
Workers need to throw an exception when presented with invalid URLs
Andrew Wilson
Reported
2009-07-28 10:40:49 PDT
Currently, if the Worker constructor is passed an invalid URL (i.e. empty string, absolute URL pointing at a different domain) the spec requires that the constructor throw an exception. We are generating an error event instead. We should address this by passing an ExceptionCode through into WorkerScriptLoader::createResourceRequest().
Attachments
Proposed Patch
(18.05 KB, patch)
2009-07-29 16:34 PDT
,
Jian Li
no flags
Details
Formatted Diff
Diff
Proposed Patch
(18.09 KB, patch)
2009-07-29 16:47 PDT
,
Jian Li
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Jian Li
Comment 1
2009-07-29 16:34:09 PDT
Created
attachment 33751
[details]
Proposed Patch
Darin Adler
Comment 2
2009-07-29 16:36:54 PDT
Comment on
attachment 33751
[details]
Proposed Patch
> - RefPtr<Worker> worker = Worker::create(scriptURL, window->document()); > + ExceptionCode ec = 0; > + RefPtr<Worker> worker = Worker::create(scriptURL, window->document(), ec); > + setDOMException(exec, ec);
I believe you should have a return 0 statement here. You don't want to call toJS on the result of the function after doing setDOMException.
Jian Li
Comment 3
2009-07-29 16:47:01 PDT
Created
attachment 33754
[details]
Proposed Patch Fixed the problem pointed out by Darin.
Darin Adler
Comment 4
2009-07-29 17:12:42 PDT
Comment on
attachment 33754
[details]
Proposed Patch
> + KURL scriptURL = context->completeURL(url); > + if (url.isEmpty() || !scriptURL.isValid()) { > + ec = SYNTAX_ERR; > + return; > + }
Seems like the url.isEmpty() check could go before the call to completeURL.
> - void loadSynchronously(ScriptExecutionContext*, const String& url, URLCompletionPolicy, CrossOriginLoadPolicy); > - void loadAsynchronously(ScriptExecutionContext*, const String& url, URLCompletionPolicy, CrossOriginLoadPolicy, WorkerScriptLoaderClient*); > + void loadSynchronously(ScriptExecutionContext*, const KURL& url, CrossOriginRedirectPolicy); > + void loadAsynchronously(ScriptExecutionContext*, const KURL& url, CrossOriginRedirectPolicy, WorkerScriptLoaderClient*);
Normally we would omit a name like "url" when the type makes it clear what it is. So in addition to changing it from String to KURL, you could remove the argument name here. r=me
Jian Li
Comment 5
2009-07-29 18:11:27 PDT
All fixed and committed as
http://trac.webkit.org/changeset/46570
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug