+2015-06-11 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r185465.
+ https://bugs.webkit.org/show_bug.cgi?id=145893
+
+ "This patch is breaking 32bit mac build" (Requested by youenn
+ on #webkit).
+
+ Reverted changeset:
+
+ "[Streams API] ReadableJSStream should handle promises
+ returned by JS source start callback"
+ https://bugs.webkit.org/show_bug.cgi?id=145792
+ http://trac.webkit.org/changeset/185465
+
2015-06-11 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
[Streams API] ReadableJSStream should handle promises returned by JS source start callback
PASS ReadableStream constructor can get initial garbage as cancel argument
PASS ReadableStream constructor can get initial garbage as pull argument
PASS ReadableStream constructor can get initial garbage as strategy argument
-PASS ReadableStream start should be able to return a promise
-PASS ReadableStream start should be able to return a promise and reject it
+TIMEOUT ReadableStream start should be able to return a promise Test timed out
+TIMEOUT ReadableStream start should be able to return a promise and reject it Test timed out
PASS ReadableStream should be able to enqueue different objects.
PASS ReadableStream: if start throws an error, it should be re-thrown
TIMEOUT ReadableStream: if pull rejects, it should error the stream Test timed out
FAIL ReadableStream: should call underlying source methods as methods releaseLock is not implemented
FAIL ReadableStream strategies: the default strategy should return false for all but the first enqueue call assert_equals: first enqueue should return true expected (boolean) true but got (undefined) undefined
FAIL ReadableStream strategies: the default strategy should continue returning true from enqueue if the chunks are read immediately assert_equals: first enqueue should return true expected (boolean) true but got (undefined) undefined
-PASS ReadableStream integration test: adapting a random push source
+TIMEOUT ReadableStream integration test: adapting a random push source Test timed out
PASS ReadableStream integration test: adapting a sync pull source
new ReadableStream({ strategy: 2 }); // Constructor should not throw when strategy is not an object.
}, 'ReadableStream constructor can get initial garbage as strategy argument');
-var test1 = async_test('ReadableStream start should be able to return a promise');
+var test1 = async_test('ReadableStream start should be able to return a promise', { timeout: 50 });
test1.step(function()
{
var readCalled = false;
}));
});
-var test2 = async_test('ReadableStream start should be able to return a promise and reject it');
+var test2 = async_test('ReadableStream start should be able to return a promise and reject it', { timeout: 100 });
test2.step(function()
{
var theError = new Error('rejected!');
})).catch(test17.step_func(function(e) { assert_unreached(e); } ));
});
-var test18 = async_test('ReadableStream integration test: adapting a random push source');
+var test18 = async_test('ReadableStream integration test: adapting a random push source', { timeout: 50 });
test18.step(function() {
var pullChecked = false;
var randomSource = new RandomPushSource(8);
+2015-06-11 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r185465.
+ https://bugs.webkit.org/show_bug.cgi?id=145893
+
+ "This patch is breaking 32bit mac build" (Requested by youenn
+ on #webkit).
+
+ Reverted changeset:
+
+ "[Streams API] ReadableJSStream should handle promises
+ returned by JS source start callback"
+ https://bugs.webkit.org/show_bug.cgi?id=145792
+ http://trac.webkit.org/changeset/185465
+
2015-06-11 Youenn Fablet <youenn.fablet@crf.canon.fr>
[Streams API] ReadableJSStream should handle promises returned by JS source start callback
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2015 Apple Inc. All rights reserved.
* Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
* Copyright (C) 2007 Maks Orlovich
- * Copyright (C) 2015 Canon Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
return result;
}
-static inline NativeExecutable* getNativeExecutable(VM& vm, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
+JSFunction* JSFunction::create(VM& vm, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
{
+ NativeExecutable* executable;
#if !ENABLE(JIT)
UNUSED_PARAM(intrinsic);
#else
if (intrinsic != NoIntrinsic && vm.canUseJIT()) {
ASSERT(nativeConstructor == callHostFunctionAsConstructor);
- return vm.getHostFunction(nativeFunction, intrinsic);
+ executable = vm.getHostFunction(nativeFunction, intrinsic);
} else
#endif
- return vm.getHostFunction(nativeFunction, nativeConstructor);
-}
+ executable = vm.getHostFunction(nativeFunction, nativeConstructor);
-JSFunction* JSFunction::create(VM& vm, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
-{
- NativeExecutable* executable = getNativeExecutable(vm, nativeFunction, intrinsic, nativeConstructor);
JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, globalObject, globalObject->functionStructure());
// Can't do this during initialization because getHostFunction might do a GC allocation.
function->finishCreation(vm, executable, length, name);
return function;
}
-struct JSStdFunction: public JSFunction {
- JSStdFunction(VM& vm, JSGlobalObject* object, Structure* structure, NativeStdFunction&& function)
- : JSFunction(vm, object, structure)
- , stdFunction(WTF::move(function)) { }
-
- NativeStdFunction stdFunction;
-};
-
-static EncodedJSValue JSC_HOST_CALL runStdFunction(ExecState* state)
-{
- JSStdFunction* jsFunction = jsCast<JSStdFunction*>(state->callee());
- ASSERT(jsFunction);
- return jsFunction->stdFunction(state);
-}
-
-JSFunction* JSFunction::create(VM& vm, JSGlobalObject* globalObject, int length, const String& name, NativeStdFunction&& nativeStdFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
-{
- NativeExecutable* executable = getNativeExecutable(vm, runStdFunction, intrinsic, nativeConstructor);
- JSStdFunction* function = new (NotNull, allocateCell<JSStdFunction>(vm.heap)) JSStdFunction(vm, globalObject, globalObject->functionStructure(), WTF::move(nativeStdFunction));
- // Can't do this during initialization because getHostFunction might do a GC allocation.
- function->finishCreation(vm, executable, length, name);
- return function;
-}
-
JSFunction::JSFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure)
: Base(vm, globalObject, structure)
, m_executable()
class JITCompiler;
}
-typedef std::function<EncodedJSValue JSC_HOST_CALL(ExecState*)> NativeStdFunction;
-
JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
static JSFunction* createWithInvalidatedReallocationWatchpoint(VM&, FunctionExecutable*, JSScope*);
- JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeStdFunction&&, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
static JSFunction* create(VM&, FunctionExecutable*, JSScope*);
static JSPromise* create(VM&, JSGlobalObject*, JSPromiseConstructor*);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
- DECLARE_EXPORT_INFO;
+ DECLARE_INFO;
enum class Status {
Unresolved,
+2015-06-11 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r185465.
+ https://bugs.webkit.org/show_bug.cgi?id=145893
+
+ "This patch is breaking 32bit mac build" (Requested by youenn
+ on #webkit).
+
+ Reverted changeset:
+
+ "[Streams API] ReadableJSStream should handle promises
+ returned by JS source start callback"
+ https://bugs.webkit.org/show_bug.cgi?id=145792
+ http://trac.webkit.org/changeset/185465
+
2015-06-11 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
[Streams API] ReadableJSStream should handle promises returned by JS source start callback
#if ENABLE(STREAMS_API)
+#include "NotImplemented.h"
#include "ReadableStreamReader.h"
#include <runtime/JSCJSValueInlines.h>
#include <wtf/RefCountedLeakCounter.h>
#include "JSDOMPromise.h"
#include "JSReadableStream.h"
#include "JSReadableStreamController.h"
+#include "NotImplemented.h"
#include "ScriptExecutionContext.h"
#include <runtime/Error.h>
#include <runtime/Exception.h>
#include <runtime/JSCJSValueInlines.h>
-#include <runtime/JSPromise.h>
#include <runtime/JSString.h>
#include <runtime/StructureInlines.h>
return call(&exec, jsFunction, callType, callData, thisValue, arguments);
}
-JSPromise* ReadableJSStream::invoke(ExecState& state, const char* propertyName)
+JSValue ReadableJSStream::invoke(ExecState& exec, const char* propertyName)
{
- JSValue function = getPropertyFromObject(state, m_source.get(), propertyName);
- if (state.hadException())
- return nullptr;
+ JSValue function = getPropertyFromObject(exec, m_source.get(), propertyName);
+ if (exec.hadException())
+ return jsUndefined();
if (!function.isFunction()) {
if (!function.isUndefined())
- throwVMError(&state, createTypeError(&state, ASCIILiteral("ReadableStream trying to call a property that is not callable")));
- return nullptr;
+ throwVMError(&exec, createTypeError(&exec, ASCIILiteral("ReadableStream trying to call a property that is not callable")));
+ return jsUndefined();
}
MarkedArgumentBuffer arguments;
- arguments.append(jsController(state, globalObject()));
-
- JSPromise* promise = jsDynamicCast<JSPromise*>(callFunction(state, function, m_source.get(), arguments));
-
- ASSERT(!(promise && state.hadException()));
- return promise;
-}
-
-static void thenPromise(ExecState& state, JSPromise* deferredPromise, JSValue fullfilFunction, JSValue rejectFunction)
-{
- JSValue thenValue = deferredPromise->get(&state, state.vm().propertyNames->then);
- if (state.hadException())
- return;
-
- MarkedArgumentBuffer arguments;
- arguments.append(fullfilFunction);
- arguments.append(rejectFunction);
-
- callFunction(state, thenValue, deferredPromise, arguments);
+ arguments.append(jsController(exec, globalObject()));
+ return callFunction(exec, function, m_source.get(), arguments);
}
JSDOMGlobalObject* ReadableJSStream::globalObject()
return jsDynamicCast<JSDOMGlobalObject*>(m_source->globalObject());
}
-static inline JSFunction* createStartResultFulfilledFunction(ExecState& state, ReadableStream& readableStream)
-{
- RefPtr<ReadableStream> stream = &readableStream;
- return JSFunction::create(state.vm(), state.callee()->globalObject(), 1, String(), [stream](ExecState*) {
- stream->start();
- return JSValue::encode(jsUndefined());
- });
-}
-
-static inline void startReadableStreamAsync(ReadableStream& readableStream)
+static void startReadableStreamAsync(ReadableStream& readableStream)
{
RefPtr<ReadableStream> stream = &readableStream;
stream->scriptExecutionContext()->postTask([stream](ScriptExecutionContext&) {
{
JSLockHolder lock(&exec);
- JSPromise* promise = invoke(exec, "start");
+ invoke(exec, "start");
if (exec.hadException())
return;
- if (!promise) {
- startReadableStreamAsync(*this);
- return;
- }
-
- thenPromise(exec, promise, createStartResultFulfilledFunction(exec, *this), m_errorFunction.get());
+ // FIXME: Implement handling promise as result of calling start function.
+ startReadableStreamAsync(*this);
}
void ReadableJSStream::doPull()
return readableStream;
}
-ReadableJSStream::ReadableJSStream(ScriptExecutionContext& scriptExecutionContext, ExecState& state, JSObject* source)
+ReadableJSStream::ReadableJSStream(ScriptExecutionContext& scriptExecutionContext, ExecState& exec, JSObject* source)
: ReadableStream(scriptExecutionContext)
{
- m_source.set(state.vm(), source);
- // We do not take a Ref to the stream as this would cause a Ref cycle.
- // The resolution callback used jointly with m_errorFunction as promise callbacks should protect the stream instead.
- m_errorFunction.set(state.vm(), JSFunction::create(state.vm(), state.callee()->globalObject(), 1, String(), [this](ExecState* state) {
- storeError(*state);
- return JSValue::encode(jsUndefined());
- }));
+ m_source.set(exec.vm(), source);
}
JSValue ReadableJSStream::jsController(ExecState& exec, JSDOMGlobalObject* globalObject)
#include <wtf/Deque.h>
#include <wtf/Ref.h>
-namespace JSC {
-class JSFunction;
-class JSPromise;
-}
-
namespace WebCore {
class JSDOMGlobalObject;
void doStart(JSC::ExecState&);
- JSC::JSPromise* invoke(JSC::ExecState&, const char*);
+ JSC::JSValue invoke(JSC::ExecState&, const char*);
void storeException(JSC::ExecState&);
void storeError(JSC::ExecState&, JSC::JSValue);
std::unique_ptr<ReadableStreamController> m_controller;
JSC::Strong<JSC::Unknown> m_error;
- JSC::Strong<JSC::JSFunction> m_errorFunction;
JSC::Strong<JSC::JSObject> m_source;
Deque<JSC::Strong<JSC::Unknown>> m_chunkQueue;
};