summaryrefslogtreecommitdiffstats
path: root/dom/base
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-02 11:07:35 -0700
committerwolfbeast <mcwerewolf@gmail.com>2018-06-07 08:52:09 +0200
commit0e550f2fb90ada0b608bc1e1982b100291651806 (patch)
tree04820ea1ba44b247afe55a0f3454b347675916bb /dom/base
parent835749ed6d411f006fe9d90ba7479233dcfe8ec7 (diff)
downloadUXP-0e550f2fb90ada0b608bc1e1982b100291651806.tar
UXP-0e550f2fb90ada0b608bc1e1982b100291651806.tar.gz
UXP-0e550f2fb90ada0b608bc1e1982b100291651806.tar.lz
UXP-0e550f2fb90ada0b608bc1e1982b100291651806.tar.xz
UXP-0e550f2fb90ada0b608bc1e1982b100291651806.zip
Refactor structured clone JSAPI to prevent mismatched scopes.
Roll-up of bugs 1442722, 1455071, 1433642, 1456604 and 1458320.
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/nsFrameMessageManager.cpp5
-rw-r--r--dom/base/nsStructuredCloneContainer.cpp2
2 files changed, 4 insertions, 3 deletions
diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp
index 049bc0a1a..6fffd376b 100644
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -271,10 +271,10 @@ BuildClonedMessageData(typename BlobTraits<Flavor>::ConcreteContentManagerType*
ClonedMessageData& aClonedData)
{
SerializedStructuredCloneBuffer& buffer = aClonedData.data();
- auto iter = aData.Data().Iter();
+ auto iter = aData.Data().Start();
size_t size = aData.Data().Size();
bool success;
- buffer.data = aData.Data().Borrow<js::SystemAllocPolicy>(iter, size, &success);
+ buffer.data = aData.Data().Borrow(iter, size, &success);
if (NS_WARN_IF(!success)) {
return false;
}
@@ -1286,6 +1286,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
if (aRetVal) {
ErrorResult rv;
StructuredCloneData* data = aRetVal->AppendElement();
+ data->InitScope(JS::StructuredCloneScope::DifferentProcess);
data->Write(cx, rval, rv);
if (NS_WARN_IF(rv.Failed())) {
aRetVal->RemoveElementAt(aRetVal->Length() - 1);
diff --git a/dom/base/nsStructuredCloneContainer.cpp b/dom/base/nsStructuredCloneContainer.cpp
index 8c2cdc091..ea2d38bc8 100644
--- a/dom/base/nsStructuredCloneContainer.cpp
+++ b/dom/base/nsStructuredCloneContainer.cpp
@@ -137,7 +137,7 @@ nsStructuredCloneContainer::GetDataAsBase64(nsAString &aOut)
return NS_ERROR_FAILURE;
}
- auto iter = Data().Iter();
+ auto iter = Data().Start();
size_t size = Data().Size();
nsAutoCString binaryData;
binaryData.SetLength(size);