Create a StructuredCloneHelperInternal and use it in the Console API

RESOLVED FIXED in Firefox 42

Status

()

RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: baku, Assigned: baku)

Tracking

Trunk
mozilla42
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox42 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

3 years ago
Created attachment 8634713 [details] [diff] [review]
clone1.patch

Console API has a custom StructuredClone algorithm use because we transfer objects from workers to the main-thread as strings (except blobs).
Attachment #8634713 - Flags: review?(bugs)
(Assignee)

Comment 1

3 years ago
Created attachment 8635282 [details] [diff] [review]
clone1.patch
Attachment #8634713 - Attachment is obsolete: true
Attachment #8634713 - Flags: review?(bugs)
Attachment #8635282 - Flags: review?(bugs)
Comment on attachment 8635282 [details] [diff] [review]
clone1.patch


>+StructuredCloneHelperInternal::Read(JSContext* aCx,
>+                                    JS::MutableHandle<JS::Value> aValue)
>+{
>+  MOZ_ASSERT(mBuffer, "Read() without Write() is not allowed.");
>+
>+  if (!mBuffer->read(aCx, aValue, &gCallbacks, this)) {
>+    return false;
>+  }
>+
>+  mBuffer = nullptr;
Why we don't set buffer to null if read fails?
I think we should.
Attachment #8635282 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/aba974f71925
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox42: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42

Comment 6

3 years ago
I think this change caused bug 1264613. As the Structured Clone API stands, cloning an object as a non-object is not allowed: it confuses our object reference counts.
Depends on: 1264613
You need to log in before you can comment on or make changes to this bug.