haikuwebkit/LayoutTests/streams/readable-stream-pipeThrough...

68 lines
2.4 KiB
HTML
Raw Permalink Normal View History

[Streams API] Implement ReadableStream pipeThrough https://bugs.webkit.org/show_bug.cgi?id=147556 Reviewed by Darin Adler. Source/JavaScriptCore: Updating BuiltIns infrastructure to make it reusable from WebCore. Extracting macros from BuiltinNames and createBuiltinExecutable from BuiltinExecutables. Updated generate-js-builtins to allow generating builtin CPP/H files in WebCore namespace. * JavaScriptCore.xcodeproj/project.pbxproj: * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createDefaultConstructor): (JSC::BuiltinExecutables::createBuiltinExecutable): (JSC::createBuiltinExecutable): (JSC::createExecutableInternal): * builtins/BuiltinExecutables.h: * builtins/BuiltinNames.h: (JSC::BuiltinNames::BuiltinNames): Deleted. * builtins/BuiltinUtils.h: Extracting code from BuiltinNames and BuiltinExecutables.h. * bytecode/UnlinkedFunctionExecutable.h: * generate-js-builtins: (getFunctions): (writeIncludeDirectives): Source/WebCore: Adding initial support for JS builtins within WebCore. This patch allows implementing IDL interface methods in JS, by using the new JSBuiltin keyword. (No support yet for private identifiers, constructors or accessors). Integration of the built-in executables and names is implemented within WebCoreJSClientData. Two files are generated for each JS builtin file: - builtin h/cpp files similar to JSCBuiltins.cpp/.h, generated through WebCore/generate-js-builtins from JavaScriptCore/generate-js-builtins) - A builtin wrapper file mimicking BuiltinExecutables (generated from WebCore/generate-js-builtins) Contrary to JSC, each js file is generating its own cpp/h file. This allows including those files within the JSXX.cpp/.h files generated from the IDL where compilation guard may take effect. Disabled GObject binding for JSBuiltin methods. Test: streams/readable-stream-pipeThrough.html * CMakeLists.txt: Triggering generate-js-builtins for JS files. * DerivedSources.make: Ditto. * ForwardingHeaders/builtins/BuiltinUtils.h: Added. * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Added. * ForwardingHeaders/runtime/ConstructAbility.h: Added. * Modules/streams/ReadableStream.idl: Marking pipeThrough as JS builtin * Modules/streams/ReadableStream.js: Added. (pipeThrough): * bindings/js/JSReadableStreamCustom.cpp: * bindings/js/WebCoreJSClientData.h: Adding ReadableStreamBuiltinsWrapper to store ReadableStream builtin executable (WebCore::WebCoreJSClientData::WebCoreJSClientData): (WebCore::WebCoreJSClientData::readableStreamBuiltins): (WebCore::initNormalWorldClientData): * bindings/scripts/CodeGeneratorGObject.pm: Disabled GObject binding for JSBuiltin methods. * bindings/scripts/CodeGeneratorJS.pm: Adding support for JSBuiltin keyword. (GetFunctionName): (GenerateHeader): (GenerateImplementation): (GenerateHashTableValueArray): (ComputeFunctionSpecial): (UseJSBuiltins): * bindings/scripts/IDLAttributes.txt: Adding JSBuiltin. * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: (webkit_dom_test_obj_js_builtin_method): (webkit_dom_test_obj_js_builtin_method_with_args): * bindings/scripts/test/GObject/WebKitDOMTestObj.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/ObjC/DOMTestObj.h: * bindings/scripts/test/ObjC/DOMTestObj.mm: (-[DOMTestObj jsBuiltinMethod]): (-[DOMTestObj jsBuiltinMethodWithArgs:strArg:objArg:]): * bindings/scripts/test/TestObj.idl: * generate-js-builtins: Added. LayoutTests: Rebased test that is now passing. Adding new tests to improve pipeThrough coverage. * streams/readable-stream-pipeThrough-expected.txt: Added. * streams/readable-stream-pipeThrough.html: Added. * streams/reference-implementation/brand-checks-expected.txt: Canonical link: https://commits.webkit.org/167580@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-09-23 07:24:42 +00:00
<!DOCTYPE html>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<script src='../resources/gc.js'></script>
<script>
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
// This is updated till https://github.com/whatwg/streams/commit/4ba861e6f60c248060811830e11271c84b439cc3
[Streams API] Implement ReadableStream pipeThrough https://bugs.webkit.org/show_bug.cgi?id=147556 Reviewed by Darin Adler. Source/JavaScriptCore: Updating BuiltIns infrastructure to make it reusable from WebCore. Extracting macros from BuiltinNames and createBuiltinExecutable from BuiltinExecutables. Updated generate-js-builtins to allow generating builtin CPP/H files in WebCore namespace. * JavaScriptCore.xcodeproj/project.pbxproj: * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createDefaultConstructor): (JSC::BuiltinExecutables::createBuiltinExecutable): (JSC::createBuiltinExecutable): (JSC::createExecutableInternal): * builtins/BuiltinExecutables.h: * builtins/BuiltinNames.h: (JSC::BuiltinNames::BuiltinNames): Deleted. * builtins/BuiltinUtils.h: Extracting code from BuiltinNames and BuiltinExecutables.h. * bytecode/UnlinkedFunctionExecutable.h: * generate-js-builtins: (getFunctions): (writeIncludeDirectives): Source/WebCore: Adding initial support for JS builtins within WebCore. This patch allows implementing IDL interface methods in JS, by using the new JSBuiltin keyword. (No support yet for private identifiers, constructors or accessors). Integration of the built-in executables and names is implemented within WebCoreJSClientData. Two files are generated for each JS builtin file: - builtin h/cpp files similar to JSCBuiltins.cpp/.h, generated through WebCore/generate-js-builtins from JavaScriptCore/generate-js-builtins) - A builtin wrapper file mimicking BuiltinExecutables (generated from WebCore/generate-js-builtins) Contrary to JSC, each js file is generating its own cpp/h file. This allows including those files within the JSXX.cpp/.h files generated from the IDL where compilation guard may take effect. Disabled GObject binding for JSBuiltin methods. Test: streams/readable-stream-pipeThrough.html * CMakeLists.txt: Triggering generate-js-builtins for JS files. * DerivedSources.make: Ditto. * ForwardingHeaders/builtins/BuiltinUtils.h: Added. * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Added. * ForwardingHeaders/runtime/ConstructAbility.h: Added. * Modules/streams/ReadableStream.idl: Marking pipeThrough as JS builtin * Modules/streams/ReadableStream.js: Added. (pipeThrough): * bindings/js/JSReadableStreamCustom.cpp: * bindings/js/WebCoreJSClientData.h: Adding ReadableStreamBuiltinsWrapper to store ReadableStream builtin executable (WebCore::WebCoreJSClientData::WebCoreJSClientData): (WebCore::WebCoreJSClientData::readableStreamBuiltins): (WebCore::initNormalWorldClientData): * bindings/scripts/CodeGeneratorGObject.pm: Disabled GObject binding for JSBuiltin methods. * bindings/scripts/CodeGeneratorJS.pm: Adding support for JSBuiltin keyword. (GetFunctionName): (GenerateHeader): (GenerateImplementation): (GenerateHashTableValueArray): (ComputeFunctionSpecial): (UseJSBuiltins): * bindings/scripts/IDLAttributes.txt: Adding JSBuiltin. * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: (webkit_dom_test_obj_js_builtin_method): (webkit_dom_test_obj_js_builtin_method_with_args): * bindings/scripts/test/GObject/WebKitDOMTestObj.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/ObjC/DOMTestObj.h: * bindings/scripts/test/ObjC/DOMTestObj.mm: (-[DOMTestObj jsBuiltinMethod]): (-[DOMTestObj jsBuiltinMethodWithArgs:strArg:objArg:]): * bindings/scripts/test/TestObj.idl: * generate-js-builtins: Added. LayoutTests: Rebased test that is now passing. Adding new tests to improve pipeThrough coverage. * streams/readable-stream-pipeThrough-expected.txt: Added. * streams/readable-stream-pipeThrough.html: Added. * streams/reference-implementation/brand-checks-expected.txt: Canonical link: https://commits.webkit.org/167580@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-09-23 07:24:42 +00:00
test(function() {
var input = {
readable: { },
writable: { }
};
var options = { };
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(undefined, input, options); });
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(null, input, options); });
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(1, input, options); });
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call({ "pipeTo": "test" }, input, options); });
}, 'ReadableStream.prototype.pipeThrough should throw when "this" has no pipeTo method');
test(function() {
var options = { };
var thisValue = {
pipeTo: function() {
assert_unreached();
}
};
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(thisValue, null, options); });
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(thisValue, undefined, options); });
}, 'ReadableStream.prototype.pipeThrough should throw when passed argument is not an object');
test(function() {
var options = { };
var error = new TypeError("potato");
var thisWrongValue = {
get pipeTo() {
throw error;
}
};
assert_throws(error, function() { ReadableStream.prototype.pipeThrough.call(thisWrongValue, { readable: { }, writable: { } }, options); });
var thisValue = {
pipeTo: function() {
assert_unreached();
}
};
var wrongInput = {
readable: { },
get writable() {
throw error;
}
};
assert_throws(error, function() { ReadableStream.prototype.pipeThrough.call(thisValue, wrongInput, options); });
var wrongInput2 = {
get readable() {
throw error;
},
writable: { }
};
var thisValue2 = {
pipeTo: function() { }
};
assert_throws(error, function() { ReadableStream.prototype.pipeThrough.call(thisValue2, wrongInput2, options); });
}, 'ReadableStream.prototype.pipeThrough should throw when called getters are throwing');
</script>