Commit bfb2a009 authored by jianli@chromium.org's avatar jianli@chromium.org

2009-06-16 Jian Li <jianli@chromium.org>

        Reviewed by Dimitri Glazkov.

        Bug 26456: Hook up V8 bindings for Worker's importScripts functionality.
        https://bugs.webkit.org/show_bug.cgi?id=26456

        * bindings/v8/custom/V8WorkerContextCustom.cpp:
        (WebCore::CALLBACK_FUNC_DECL):
        * bindings/v8/custom/V8WorkerCustom.cpp: Fixed missing exception code
          handling in Worker constructor for V8 bindings.
        (WebCore::CALLBACK_FUNC_DECL):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 60eeb9a2
2009-06-16 Jian Li <jianli@chromium.org>
Reviewed by Dimitri Glazkov.
Bug 26456: Hook up V8 bindings for Worker's importScripts functionality.
https://bugs.webkit.org/show_bug.cgi?id=26456
* bindings/v8/custom/V8WorkerContextCustom.cpp:
(WebCore::CALLBACK_FUNC_DECL):
* bindings/v8/custom/V8WorkerCustom.cpp: Fixed missing exception code
handling in Worker constructor for V8 bindings.
(WebCore::CALLBACK_FUNC_DECL):
2009-06-16 Brent Fulgham <bfulgham@webkit.org>
Reviewed by Maciej Stachowiak.
......
......@@ -36,7 +36,6 @@
#include "ExceptionCode.h"
#include "DOMTimer.h"
#include "NotImplemented.h"
#include "ScheduledAction.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
......@@ -129,7 +128,29 @@ v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singl
CALLBACK_FUNC_DECL(WorkerContextImportScripts)
{
INC_STATS(L"DOM.WorkerContext.importScripts()");
notImplemented();
if (!args.Length())
return v8::Undefined();
String callerURL = V8Proxy::GetSourceName();
int callerLine = V8Proxy::GetSourceLineNumber() + 1;
Vector<String> urls;
for (int i = 0; i < args.Length(); i++) {
v8::TryCatch tryCatch;
v8::Handle<v8::String> scriptUrl = args[i]->ToString();
if (tryCatch.HasCaught() || scriptUrl.IsEmpty())
return v8::Undefined();
urls.append(toWebCoreString(scriptUrl));
}
WorkerContext* workerContext = V8Proxy::ToNativeObject<WorkerContext>(V8ClassIndex::WORKERCONTEXT, args.Holder());
ExceptionCode ec = 0;
workerContext->importScripts(urls, callerURL, callerLine, ec);
if (ec)
return throwError(ec);
return v8::Undefined();
}
......
......@@ -87,6 +87,9 @@ CALLBACK_FUNC_DECL(WorkerConstructor)
ExceptionCode ec = 0;
RefPtr<Worker> obj = Worker::create(toWebCoreString(scriptUrl), context, ec);
if (ec)
return throwError(ec);
// Setup the standard wrapper object internal fields.
v8::Handle<v8::Object> wrapperObject = args.Holder();
V8Proxy::SetDOMWrapper(wrapperObject, V8ClassIndex::WORKER, obj.get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment