Closed Bug 1410194 Opened 7 years ago Closed 7 years ago

Change objectEmulatingUndefined function to be/act more like document.all

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: Waldo, Assigned: Waldo)

Details

Attachments

(1 file)

test262 is adding a $262.IsHTMLDDA optional property that's supposed to be an object that acts like document.all in a few ways.  We have objectEmulatingUndefined for this purpose, but that function returns more of a plain-vanilla object without some desired characteristics of document.all -- namely, if you call it with no arguments or the single argument "" it returns null.  Should be easy to rename our function to something better, and to make it return an object with those additional behaviors.

I'll sort this out once upstream test262 lands the optional property and feature for it, so when we next import we'll automatically begin running the fresh tests.
Attachment #8920446 - Flags: review?(andrebargull)
Comment on attachment 8920446 [details] [diff] [review]
add-ishtmldda.diff

Review of attachment 8920446 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me except for the intentional crash and name.

::: js/src/shell/js.cpp
@@ +5169,5 @@
> +    // not fuzzing, and throw an exception if fuzzing.  (Don't just throw
> +    // in all circumstances: such exception might be caught, or ignored, or
> +    // in certain cases mistaken for success.)
> +    if (!fuzzingSafe)
> +        MOZ_CRASH("IsHTMLDDA object is being called in an impermissible manner");

I wonder how long it'll take when we get the first bug report that the js-shell crashes in this function. For example we've seen community members doing their own fuzzing, but without disabling fuzzing unsafe functions first. So in other words, I don't really like adding functions which can easily crash the shell.

@@ +6845,4 @@
>  "getMaxArgs()",
>  "  Return the maximum number of supported args for a call."),
>  
> +    JS_FN_HELP("makeIsHTMLDDA", MakeIsHTMLDDA, 0, 0,

Can we call this "createIsHTMLDDA" or "newIsHTMLDDA"? "make" doesn't necessarily imply (to me) that an object is returned, it could also mean that some kind of state is modified. I also don't actually like the name "IsHTMLDDA", but if that's what they decided to use in the spec...

::: js/src/tests/test262-host.js
@@ +22,5 @@
> +    if (!hasMakeIsHTMLDDA && !("document" in global && "all" in global.document))
> +        throw new Error("no [[IsHTMLDDA]] object available for testing");
> +
> +    var IsHTMLDDA = hasMakeIsHTMLDDA
> +                  ? global.makeIsHTMLDDA()

I think we always align ?: with the condition.
Attachment #8920446 - Flags: review?(andrebargull) → review+
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c06db608ed52
Add support for $262.IsHTMLDDA to test262-host.js.  r=anba
https://hg.mozilla.org/mozilla-central/rev/c06db608ed52
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: