diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 22:23:36 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 22:23:36 +0000 |
commit | 6061d44257cb8b334112d349bd0a32cf16fb6c68 (patch) | |
tree | dc2c7c3e15b211d7272bf556a2fb96eacbc9ed24 /webkit/port | |
parent | 701cf8d354f62ad1a71976f95230b1c1dd8ae5b4 (diff) | |
download | chromium_src-6061d44257cb8b334112d349bd0a32cf16fb6c68.zip chromium_src-6061d44257cb8b334112d349bd0a32cf16fb6c68.tar.gz chromium_src-6061d44257cb8b334112d349bd0a32cf16fb6c68.tar.bz2 |
Fix worker constructor so that nested worker can be created.
Review URL: http://codereview.chromium.org/67093
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/bindings/v8/V8WorkerCustom.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/webkit/port/bindings/v8/V8WorkerCustom.cpp b/webkit/port/bindings/v8/V8WorkerCustom.cpp index 1f7e5fe..d5c2661 100644 --- a/webkit/port/bindings/v8/V8WorkerCustom.cpp +++ b/webkit/port/bindings/v8/V8WorkerCustom.cpp @@ -42,6 +42,7 @@ #include "V8HTMLDocument.h" #include "V8ObjectEventListener.h" #include "Worker.h" +#include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" namespace WebCore { @@ -75,18 +76,24 @@ CALLBACK_FUNC_DECL(WorkerConstructor) { return v8::Undefined(); } - // Get the document. - Frame* frame = V8Proxy::retrieveFrame(); - if (!frame) - return v8::Undefined(); - Document* document = frame->document(); + // Get the script execution context. + ScriptExecutionContext* context = 0; + WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve(); + if (proxy) + context = proxy->workerContext(); + else { + Frame* frame = V8Proxy::retrieveFrame(); + if (!frame) + return v8::Undefined(); + context = frame->document(); + } // Create the worker object. // Note: it's OK to let this RefPtr go out of scope because we also call // SetDOMWrapper(), which effectively holds a reference to obj. ExceptionCode ec = 0; RefPtr<Worker> obj = Worker::create( - ToWebCoreString(script_url), document, ec); + ToWebCoreString(script_url), context, ec); // Setup the standard wrapper object internal fields. v8::Handle<v8::Object> wrapper_object = args.Holder(); |