window.postMessage() / MessagePort.postMessage() throw wrong exception for invalid ports argument
https://bugs.webkit.org/show_bug.cgi?id=94581

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-08-22
Reviewed by Kentaro Hara.

Source/WebCore:

Update JSC and V8 implementations of window.postMessage() and
MessagePort.postMessage() in order to throw an
INVALID_STATE_ERR instead of a DATA_CLONE_ERR when values
in the "ports" argument are invalid. Additionally, we now
check for duplicate ports and throw an exception for this
case as well.

This change was made to comply with the latest HTML5
specification at:
http://www.w3.org/TR/html5/comms.html

No new tests, already tested by:
fast/events/constructors/message-event-constructor.html
fast/events/message-port-clone.html
fast/events/message-port-multi.html
fast/workers/worker-context-multi-port.html
fast/workers/worker-multi-port.html

* bindings/js/JSMessagePortCustom.cpp:
(WebCore::fillMessagePortArray):
* bindings/v8/V8Utilities.cpp:
(WebCore::extractTransferables):
* dom/MessagePort.cpp:
(WebCore::MessagePort::postMessage):

LayoutTests:

Update several tests and their expected results now that an
INVALID_STATE_ERR is thrown instead of a DATA_CLONE_ERROR
when window.postMessage() / MessagePort.postMessage() are
called with invalid values in their 'ports' argument.

* fast/events/constructors/message-event-constructor-expected.txt:
* fast/events/constructors/message-event-constructor.html: Stop using duplicate
ports in the test since it throws an exception now.
* fast/events/message-port-clone-expected.txt:
* fast/events/message-port-multi-expected.txt:
* fast/events/resources/message-port-multi.js: Add check for duplicate port case.
* fast/workers/worker-context-multi-port-expected.txt:
* fast/workers/worker-multi-port-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] REGRESSION(r125428): fast/profiler/nested-start-and-stop-profiler.html fails
https://bugs.webkit.org/show_bug.cgi?id=93897

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Before r125428 run-time methods (wrapped signals, slots or invokable
functions) were subclasses of JSInternalFunction and therefore real
function objects in the JavaScript sense. r125428 changed them to be
just callable objects, but they did not have Function.prototype as
prototype anymore for example nor was their name correct (resulting in
a layout test failure).

This patch changes run-time methods back to being real function objects
that have a correct name and have Function.prototype in their prototype
change

The objects returned by JSObjectMakeFunctionWithCallbackInjected are
light-weight internal function objects that do not support
JSObject{Set/Get}Private. Therefore we inject our own prototype right
before the Function.prototype prototype, which uses private data to
store a pointer to our C++ QtRuntimeMethod object.  This complicates
the retrieval of the pointer to that instance slightly, which is why
this patch introduces the toRuntimeMethod convenience function that
looks up our prototype first and does a check for type-safety.

At the same time the patch removes the length properties from the
run-time method itself as well as connect/disconnect.  The length
property on a function signifies the number of arguments, but in all
three cases that number is actually variable, because of overloading.
That is why we choose not to expose it in the first place.

In QtInstance we cache the JS wrapper objects for QtRuntimeMethod in a
JSWeakObjectMap. JSWeakObjectMap requires the stored objects to be
either the result of JSObjectMake or the global object of a context ref
(AFAICS), which is ensured using an ASSERT. Objects created via
JSObjectMakeFunctionWithCalllback do not fall into the required
category, cause a failing assertion and can therefore not be stored in
the weak object map.

Consequently this patch removes the use of JSWeakObjectMap again and
goes back to the old way of using the internal Weak<> API, for the time
being. In a future patch the storage will be simplified to not require
the use of a weak object map cache for the run-time methods anymore.

* bridge/qt/qt_instance.cpp: Remove unused WeakMap code.
* bridge/qt/qt_instance.h: Remove method cache.
(QtInstance):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::prototypeForSignalsAndSlots):
(JSC::Bindings::QtRuntimeMethod::call):
(JSC::Bindings::QtRuntimeMethod::jsObjectRef):
(JSC::Bindings::QtRuntimeMethod::toRuntimeMethod):
(Bindings):
(JSC::Bindings::QtRuntimeMethod::connectOrDisconnect):
* bridge/qt/qt_runtime.h:
(QtRuntimeMethod): Remove unused member variables.

Source/WebKit/qt:

Fixed some test expectations.

* tests/qobjectbridge/tst_qobjectbridge.cpp:
(tst_QObjectBridge::objectDeleted): Since runtime methods are real function objects again, we
can go back to testing Function.prototype.call, as it was done before r125428.
(tst_QObjectBridge::introspectQtMethods_data): Removed tests for the length property.
(tst_QObjectBridge::introspectQtMethods): Changed test expectation of the properties of
run-time methods back to being non-configurable, as before r125428.

LayoutTests:

* platform/qt/Skipped: Unskip test that is now passing.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126287 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Test and test expectation of Shadow DOM for button should be fixed.
https://bugs.webkit.org/show_bug.cgi?id=94674

Reviewed by Hajime Morita.

Now that the HTMLButtonElement was AuthroShadowDOM-ready, it's time to update the previous
failing tests for AuthroShadowDOM for button elements.

I've updated the failing tests to follow the current implementation and updated the test expectations.

* fast/dom/shadow/shadowdom-for-button-complex-shadow-expected.html:
* fast/dom/shadow/shadowdom-for-button-complex-shadow.html:
* fast/dom/shadow/shadowdom-for-button-only-shadow-expected.html:
* fast/dom/shadow/shadowdom-for-button-only-shadow.html:
* fast/dom/shadow/shadowdom-for-button-without-shadow-expected.html:
* fast/dom/shadow/shadowdom-for-button-without-shadow.html:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Unreviewed gardening.

Gardening after r126025 & r126275.

* platform/efl/TestExpectations: Unskipping one, skipping another.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126289 268f45cc-cd09-0410-ab3c-d52691b4dbfc