Closed Bug 1075294 Opened 7 years ago Closed 7 years ago

Object.seal() should return its argument with no conversion when the argument is a primitive value


(Core :: JavaScript: Standard Library, defect)

Not set





(Reporter: 446240525, Assigned: 446240525)



(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])


(1 file, 1 obsolete file)

js> Object.seal("foo")
TypeError: "foo" is not an object
// should return "foo"
Attached patch bug-1075294.patch (obsolete) — Splinter Review
Attachment #8497926 - Flags: review?(till)
Comment on attachment 8497926 [details] [diff] [review]

Review of attachment 8497926 [details] [diff] [review]:

r=me with tiny nits addressed. Amazing that we didn't have any tests for throwing on primitives here. :(

For patches as simple as this one, you can just start a try server run right when asking for review. (As always for things like this: Linux (64 or 32, doesn't matter) only, debug only, all tests except Talos.) Then, once the reviewer gives an r+, you can either set checkin-needed directly, or upload a new version with nits addressed, carry over the r+, and note which comment the try run can be found in. If you think that, even though the reviewer gave an r+, the needed changes warrant another try run, just do that and mention it when uploading the final patch.

Spec note: I'm not particularly convinced that `success = !!(Object.seal(false))` is particularly good behavior. But then again, it also doesn't matter much: calling seal on primitives really just isn't something one should do. Also, the spec is the spec. (In this case, because I don't think it's important enough to get into discussions about. In other cases, we do give feedback to tc39 and try to fix errors.

::: js/src/builtin/Object.cpp
@@ +1092,2 @@
> +    // step 1

Uber-nit: Upper-case "S" and "." at EOL, please. Here and below.
Attachment #8497926 - Flags: review?(till) → review+
Attachment #8497926 - Attachment is obsolete: true
Attachment #8498101 - Flags: review+
Got r+ at comment 3.
Green try run at comment 2.
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.