Commit 88b63614 authored by abarth@webkit.org's avatar abarth@webkit.org

Moving ScriptExecutionContext to the front of the argument list for

IDL constructors that use ConstructorWith=ScriptExecutionContext.
https://bugs.webkit.org/show_bug.cgi?id=69799

Patch by Anna Cavender <annacc@chromium.org> on 2011-10-12
Reviewed by Adam Barth.

Tests:
- http/tests/eventsource/* (for EventSource)
- fast/filesystem/* (for Worker)

* bindings/js/JSEventSourceCustom.cpp:
(WebCore::JSEventSourceConstructor::constructJSEventSource):
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateConstructorCallback):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::V8TestInterface::constructorCallback):
* page/EventSource.cpp:
(WebCore::EventSource::create):
* page/EventSource.h:
* workers/Worker.cpp:
(WebCore::Worker::create):
* workers/Worker.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97287 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b213585b
2011-10-12 Anna Cavender <annacc@chromium.org>
Moving ScriptExecutionContext to the front of the argument list for
IDL constructors that use ConstructorWith=ScriptExecutionContext.
https://bugs.webkit.org/show_bug.cgi?id=69799
Reviewed by Adam Barth.
Tests:
- http/tests/eventsource/* (for EventSource)
- fast/filesystem/* (for Worker)
* bindings/js/JSEventSourceCustom.cpp:
(WebCore::JSEventSourceConstructor::constructJSEventSource):
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateConstructorCallback):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::V8TestInterface::constructorCallback):
* page/EventSource.cpp:
(WebCore::EventSource::create):
* page/EventSource.h:
* workers/Worker.cpp:
(WebCore::Worker::create):
* workers/Worker.h:
2011-10-11 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=69896
......@@ -56,7 +56,7 @@ EncodedJSValue JSC_HOST_CALL JSEventSourceConstructor::constructJSEventSource(Ex
return throwVMError(exec, createReferenceError(exec, "EventSource constructor associated document is unavailable"));
ExceptionCode ec = 0;
RefPtr<EventSource> eventSource = EventSource::create(ustringToString(url), context, ec);
RefPtr<EventSource> eventSource = EventSource::create(context, ustringToString(url), ec);
if (ec) {
setDOMException(exec, ec);
return JSValue::encode(JSValue());
......
......@@ -65,7 +65,7 @@ EncodedJSValue JSC_HOST_CALL JSWorkerConstructor::constructJSWorker(ExecState* e
DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl();
ExceptionCode ec = 0;
RefPtr<Worker> worker = Worker::create(ustringToString(scriptURL), window->document(), ec);
RefPtr<Worker> worker = Worker::create(window->document(), ustringToString(scriptURL), ec);
if (ec) {
setDOMException(exec, ec);
return JSValue::encode(JSValue());
......
......@@ -1545,8 +1545,9 @@ END
my ($parameterCheckString, $paramIndex) = GenerateParametersCheck($function, $implClassName);
push(@implContent, $parameterCheckString);
my @contextArgument;
if ($dataNode->extendedAttributes->{"ConstructorWith"} && $dataNode->extendedAttributes->{"ConstructorWith"} eq "ScriptExecutionContext") {
push(@extraArgumentList, "context");
push(@contextArgument, "context");
push(@implContent, <<END);
ScriptExecutionContext* context = getScriptExecutionContext();
......@@ -1567,7 +1568,7 @@ END
$index++;
}
my $argumentString = join(", ", @argumentList, @extraArgumentList);
my $argumentString = join(", ", @contextArgument, @argumentList, @extraArgumentList);
push(@implContent, "\n");
push(@implContent, " RefPtr<${implClassName}> obj = ${implClassName}::create(${argumentString});\n");
......
......@@ -61,7 +61,7 @@ v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments&
if (!context)
return throwError("TestInterface constructor's associated context is not available", V8Proxy::ReferenceError);
RefPtr<TestInterface> obj = TestInterface::create(str1, str2, context, ec);
RefPtr<TestInterface> obj = TestInterface::create(context, str1, str2, ec);
if (ec)
goto fail;
......
......@@ -69,7 +69,7 @@ inline EventSource::EventSource(const KURL& url, ScriptExecutionContext* context
{
}
PassRefPtr<EventSource> EventSource::create(const String& url, ScriptExecutionContext* context, ExceptionCode& ec)
PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, const String& url, ExceptionCode& ec)
{
if (url.isEmpty()) {
ec = SYNTAX_ERR;
......
......@@ -51,7 +51,7 @@ namespace WebCore {
class EventSource : public RefCounted<EventSource>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<EventSource> create(const String& url, ScriptExecutionContext*, ExceptionCode&);
static PassRefPtr<EventSource> create(ScriptExecutionContext*, const String& url, ExceptionCode&);
virtual ~EventSource();
static const unsigned long long defaultReconnectDelay;
......
......@@ -56,7 +56,7 @@ inline Worker::Worker(ScriptExecutionContext* context)
{
}
PassRefPtr<Worker> Worker::create(const String& url, ScriptExecutionContext* context, ExceptionCode& ec)
PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& url, ExceptionCode& ec)
{
RefPtr<Worker> worker = adoptRef(new Worker(context));
......
......@@ -51,7 +51,7 @@ namespace WebCore {
class Worker : public AbstractWorker, private WorkerScriptLoaderClient {
public:
static PassRefPtr<Worker> create(const String& url, ScriptExecutionContext*, ExceptionCode&);
static PassRefPtr<Worker> create(ScriptExecutionContext*, const String& url, ExceptionCode&);
virtual ~Worker();
virtual Worker* toWorker() { return this; }
......
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