Closed Bug 1184541 Opened 4 years ago Closed 4 years ago

Create a StructuredCloneHelperInternal and use it in the Console API

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: baku, Assigned: baku)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch clone1.patch (obsolete) — Splinter Review
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)
Attached patch clone1.patchSplinter Review
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
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
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.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.