WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
CR comments addressed (thanks David!)
70658.patch (text/plain), 10.87 KB, created by
Dmitry Lomov
on 2011-10-25 11:20:00 PDT
(
hide
)
Description:
CR comments addressed (thanks David!)
Filename:
MIME Type:
Creator:
Dmitry Lomov
Created:
2011-10-25 11:20:00 PDT
Size:
10.87 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index ee0bf67..b15a784 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2011-10-24 Dmitry Lomov <dslomov@google.com> >+ >+ https://bugs.webkit.org/show_bug.cgi?id=70658 >+ [JSC] Implement MessagePort transfer in JSC bindings implementation of webkitPostMessage. >+ Some 'FAIL's remain in expected test results. These are due to the fact that >+ JSC bindings chose not to throw type error exception for non-serializable values - >+ non-serializable values are serialized as null. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/dom/Window/window-postmessage-args-expected.txt: >+ * fast/events/message-port-multi-expected.txt: >+ > 2011-10-24 Tim Horton <timothy_horton@apple.com> > > feColorMatrix doesn't use the correct default "matrix" type when no type attribute is specified >diff --git a/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt b/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt >index fb39b48..ae7ab43 100644 >--- a/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt >+++ b/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt >@@ -31,7 +31,7 @@ Received message '7' with 2 ports. > Received message '2147483648' with 0 ports. > Received message '2147483648' with 0 ports. > Received message '[object Object]' with 2 ports. >-Received message '[object Object]' with 2 ports. >-Received message '[object Object],[object Object]' with 2 ports. >+Received message '[object MessagePort]' with 2 ports. >+Received message '[object MessagePort],[object MessagePort]' with 2 ports. > Received message 'done' with 0 ports. > >diff --git a/LayoutTests/fast/events/message-port-multi-expected.txt b/LayoutTests/fast/events/message-port-multi-expected.txt >index 903eb6c..8e8cdf4 100644 >--- a/LayoutTests/fast/events/message-port-multi-expected.txt >+++ b/LayoutTests/fast/events/message-port-multi-expected.txt >@@ -15,9 +15,9 @@ PASS event.ports is non-null and zero length when empty array sent > PASS event.ports contains two ports when two ports sent > PASS event.ports contains two ports when two ports re-sent after error > FAIL Sending host object should throw >-FAIL send-port: port transfer failed >-FAIL send-port-twice: failed to transfer one port twice >-FAIL send-two-ports: failed to transfer two ports >+PASS send-port: transferred one port >+PASS send-port-twice: transferred one port twice >+PASS send-two-ports: transferred two ports > FAIL Unexpected message [object Object] > > TEST COMPLETE >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 176c974..aac3465 100755 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2011-10-24 Dmitry Lomov <dslomov@google.com> >+ >+ https://bugs.webkit.org/show_bug.cgi?id=70658 >+ [JSC] Implement MessagePort transfer in JSC bindings implementation of webkitPostMessage. >+ Transfer of MessagePorts implemented. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bindings/js/SerializedScriptValue.cpp: >+ (WebCore::CloneSerializer::serialize): >+ (WebCore::CloneSerializer::CloneSerializer): >+ (WebCore::CloneSerializer::dumpIfTerminal): >+ (WebCore::CloneDeserializer::deserialize): >+ (WebCore::CloneDeserializer::CloneDeserializer): >+ (WebCore::CloneDeserializer::readTerminal): >+ (WebCore::SerializedScriptValue::create): >+ (WebCore::SerializedScriptValue::deserialize): >+ > 2011-10-24 Joseph Pecoraro <joepeck@webkit.org> > > Remove unused instance variable >diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >index 962bf5d..8deb00b 100644 >--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp >+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >@@ -36,6 +36,7 @@ > #include "JSFile.h" > #include "JSFileList.h" > #include "JSImageData.h" >+#include "JSMessagePort.h" > #include "JSNavigator.h" > #include "SharedBuffer.h" > #include <limits> >@@ -88,6 +89,7 @@ enum SerializationTag { > EmptyStringTag = 17, > RegExpTag = 18, > ObjectReferenceTag = 19, >+ MessagePortReferenceTag = 20, > ErrorTag = 255 > }; > >@@ -133,6 +135,7 @@ static const unsigned int StringPoolTag = 0xFFFFFFFE; > * | ImageData > * | Blob > * | ObjectReferenceTag <opIndex:IndexType> >+ * | MessagePortReferenceTag <value:uint32_t> > * > * String :- > * EmptyStringTag >@@ -251,9 +254,9 @@ template <typename T> static bool writeLittleEndian(Vector<uint8_t>& buffer, con > > class CloneSerializer : CloneBase { > public: >- static SerializationReturnCode serialize(ExecState* exec, JSValue value, Vector<uint8_t>& out) >+ static SerializationReturnCode serialize(ExecState* exec, JSValue value, MessagePortArray* messagePorts, Vector<uint8_t>& out) > { >- CloneSerializer serializer(exec, out); >+ CloneSerializer serializer(exec, messagePorts, out); > return serializer.serialize(value); > } > >@@ -270,12 +273,20 @@ public: > } > > private: >- CloneSerializer(ExecState* exec, Vector<uint8_t>& out) >+ CloneSerializer(ExecState* exec, MessagePortArray* messagePorts, Vector<uint8_t>& out) > : CloneBase(exec) > , m_buffer(out) > , m_emptyIdentifier(exec, UString("", 0)) > { > write(CurrentVersion); >+ if (messagePorts) { >+ JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); >+ for (size_t i = 0; i < messagePorts->size(); i++) { >+ JSC::JSValue value = toJS(exec, globalObject, messagePorts->at(i).get()); >+ if (value.getObject()) >+ m_transferredMessagePorts.add(value.getObject(), i); >+ } >+ } > } > > SerializationReturnCode serialize(JSValue in); >@@ -474,6 +485,16 @@ private: > write(UString(flags, flagCount)); > return true; > } >+ if (obj->inherits(&JSMessagePort::s_info)) { >+ ObjectPool::iterator index = m_transferredMessagePorts.find(obj); >+ if (index != m_transferredMessagePorts.end()) { >+ write(MessagePortReferenceTag); >+ uint32_t i = index->second; >+ write(i); >+ return true; >+ } >+ return false; >+ } > > CallData unusedData; > if (getCallData(value, unusedData) == CallTypeNone) >@@ -604,6 +625,7 @@ private: > Vector<uint8_t>& m_buffer; > typedef HashMap<JSObject*, uint32_t> ObjectPool; > ObjectPool m_objectPool; >+ ObjectPool m_transferredMessagePorts; > typedef HashMap<RefPtr<StringImpl>, uint32_t, IdentifierRepHash> StringConstantPool; > StringConstantPool m_constantPool; > Identifier m_emptyIdentifier; >@@ -784,11 +806,12 @@ public: > return String(str.impl()); > } > >- static DeserializationResult deserialize(ExecState* exec, JSGlobalObject* globalObject, const Vector<uint8_t>& buffer) >+ static DeserializationResult deserialize(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, >+ const Vector<uint8_t>& buffer) > { > if (!buffer.size()) > return make_pair(jsNull(), UnspecifiedError); >- CloneDeserializer deserializer(exec, globalObject, buffer); >+ CloneDeserializer deserializer(exec, globalObject, messagePorts, buffer); > if (!deserializer.isValid()) > return make_pair(JSValue(), ValidationError); > return deserializer.deserialize(); >@@ -833,13 +856,14 @@ private: > size_t m_index; > }; > >- CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, const Vector<uint8_t>& buffer) >+ CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, const Vector<uint8_t>& buffer) > : CloneBase(exec) > , m_globalObject(globalObject) > , m_isDOMGlobalObject(globalObject->inherits(&JSDOMGlobalObject::s_info)) > , m_ptr(buffer.data()) > , m_end(buffer.data() + buffer.size()) > , m_version(0xFFFFFFFF) >+ , m_messagePorts(messagePorts) > { > if (!read(m_version)) > m_version = 0xFFFFFFFF; >@@ -1178,6 +1202,16 @@ private: > } > return m_gcBuffer.at(index); > } >+ case MessagePortReferenceTag: { >+ uint32_t index; >+ bool indexSuccessfullyRead = read(index); >+ if (!indexSuccessfullyRead || !m_messagePorts || index >= m_messagePorts->size()) { >+ fail(); >+ return JSValue(); >+ } >+ return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject()), >+ m_messagePorts->at(index).get()); >+ } > default: > m_ptr--; // Push the tag back > return JSValue(); >@@ -1190,6 +1224,7 @@ private: > const uint8_t* m_end; > unsigned m_version; > Vector<CachedString> m_constantPool; >+ MessagePortArray* m_messagePorts; > }; > > DeserializationResult CloneDeserializer::deserialize() >@@ -1276,6 +1311,7 @@ DeserializationResult CloneDeserializer::deserialize() > if (!readStringData(cachedString, wasTerminator)) { > if (!wasTerminator) > goto error; >+ > JSObject* outObject = outputObjectStack.last(); > outValue = outObject; > outputObjectStack.removeLast(); >@@ -1339,10 +1375,10 @@ SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>& buffer) > m_data.swap(buffer); > } > >-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(ExecState* exec, JSValue value, MessagePortArray*, SerializationErrorMode throwExceptions) >+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(ExecState* exec, JSValue value, MessagePortArray* messagePorts, SerializationErrorMode throwExceptions) > { > Vector<uint8_t> buffer; >- SerializationReturnCode code = CloneSerializer::serialize(exec, value, buffer); >+ SerializationReturnCode code = CloneSerializer::serialize(exec, value, messagePorts, buffer); > if (throwExceptions == Throwing) > maybeThrowExceptionIfSerializationFailed(exec, code); > >@@ -1395,9 +1431,9 @@ String SerializedScriptValue::toString() > } > > JSValue SerializedScriptValue::deserialize(ExecState* exec, JSGlobalObject* globalObject, >- MessagePortArray*, SerializationErrorMode throwExceptions) >+ MessagePortArray* messagePorts, SerializationErrorMode throwExceptions) > { >- DeserializationResult result = CloneDeserializer::deserialize(exec, globalObject, m_data); >+ DeserializationResult result = CloneDeserializer::deserialize(exec, globalObject, messagePorts, m_data); > if (throwExceptions == Throwing) > maybeThrowExceptionIfSerializationFailed(exec, result.second); > return result.first;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 70658
:
112296
| 112364