[Streams API] Add support for private WebCore JS builtins functions
https://bugs.webkit.org/show_bug.cgi?id=149518

Reviewed by Darin Adler.

Source/JavaScriptCore:

Adding API to add private identifiers on the fly.
This is used to support private JS Builtin functions/private JS Builtin names in WebCore.

* builtins/BuiltinNames.h:
(JSC::BuiltinNames::appendExternalName):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::appendExternalName):
* runtime/CommonIdentifiers.h:

Source/WebCore:

Using ReadableStream tee method as a testbed to add support for private WebCore JS builtins functions.
Private functions are hooked to JSDOMWindowBase, as it is the one connected to WebCoreClientData.
WebCoreClientData is responsible to export the private function symbols to the VM.

Updated generate-js-builtins script to generate a class that can create and own all JS functions.
This class is used by JSDOMWindowBase to create the JS builtin functions.
It is also used to manage the GC of these objects.

Covered by rebased tests.

* CMakeLists.txt: Adding ReadableStreamInternals builtin files.
* DerivedSources.cpp: Ditto.
* DerivedSources.make: Ditto.
* Modules/streams/ReadableStream.idl: Adding tee declaration as builtin
* Modules/streams/ReadableStream.js:
(tee): Calling @teeReadableStream
* Modules/streams/ReadableStreamInternals.js: Barebone @teeReadableStream implementation.
(teeReadableStream):
* WebCore.vcxproj/WebCore.vcxproj: Adding ReadableStreamInternals builtin files.
* WebCore.xcodeproj/project.pbxproj: Adding ReadableStreamInternals builtin files.
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase): Creating ReadableStreamInternalsBuiltinFunctions object.
(WebCore::JSDOMWindowBase::finishCreation): Creating builtin functions through ReadableStreamInternalsBuiltinFunctions and registering them to the JS engine.
(WebCore::JSDOMWindowBase::visitChildren): Ensuring GC does not collect private builtin functions through ReadableStreamInternalsBuiltinFunctions object
* bindings/js/JSDOMWindowBase.h:
* bindings/js/WebCoreJSClientData.h:
(WebCore::WebCoreJSClientData::WebCoreJSClientData): Exporting private names of ReadableStreamInternalsBuiltins
(WebCore::WebCoreJSClientData::readableStreamBuiltins):
(WebCore::WebCoreJSClientData::readableStreamInternalsBuiltins):
* generate-js-builtins: Adding support for ReadableStreamInternalsBuiltinFunctions and exportNames.

LayoutTests:

Rebasing tests now that tee is appearing in the IDL, although not yet conformant in its implementation.

* streams/reference-implementation/readable-stream-expected.txt:
* streams/reference-implementation/readable-stream-tee-expected.txt:
* streams/reference-implementation/readable-stream-templated-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@190401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/Modules/streams/ReadableStreamInternals.js b/Source/WebCore/Modules/streams/ReadableStreamInternals.js
new file mode 100644
index 0000000..4fc7e2e
--- /dev/null
+++ b/Source/WebCore/Modules/streams/ReadableStreamInternals.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 Canon Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function teeReadableStream(stream, shouldClone)
+{
+    "use strict";
+
+    throw new @TypeError("tee is not implemented");
+}