Closed Bug 1311426 Opened 3 years ago Closed 3 years ago

Add rep for Boolean, Number and String

Categories

(DevTools :: Shared Components, defect)

defect
Not set

Tracking

(firefox52 fixed)

RESOLVED FIXED
Firefox 52
Tracking Status
firefox52 --- fixed

People

(Reporter: ntim, Assigned: nchevobbe)

References

Details

Attachments

(1 file)

Old console:
>> var b = new Boolean(""); b;
<- Boolean { false }
>> var b = new Boolean("blah"); b;
<- Boolean { true }

New console
>> var b = new Boolean(""); b;
<- Boolean { }
>> var b = new Boolean("blah"); b;
<- Boolean { }
The same bug applies to the Number and String constructors.
Summary: Add rep for Boolean → Add rep for Boolean, Number and String
Comment on attachment 8803829 [details]
Bug 1311426 - Handle Grip with wrapped value in Reps. ;

https://reviewboard.mozilla.org/r/87988/#review88452

::: devtools/client/shared/components/reps/grip.js:53
(Diff revision 1)
>        }
>        return [];
>      },
>  
>      propIterator: function (object, max) {
> +      if (Object.keys(object.preview).includes("wrappedValue")) {

I don't understand this construct, what is the "wrappedValue" field for?
Comment on attachment 8803829 [details]
Bug 1311426 - Handle Grip with wrapped value in Reps. ;

https://reviewboard.mozilla.org/r/87988/#review88452

> I don't understand this construct, what is the "wrappedValue" field for?

wrappedValue hold the value of the object for primitive object instanciated with the constructor.
For example , `new String("foo")` returns the following stub :

    {
      "type": "object",
      "actor": "server1.conn1.child1/obj61",
      "class": "String",
      "ownPropertyLength": 4,
      "preview": {
        "kind": "Object",
        "ownProperties": {},
        "ownPropertiesLength": 4,
        "safeGetterValues": {},
        "wrappedValue": "foo"
      }
    }
    
Where we see that the wrappedValue is `"foo"`.
It's the same for Boolean and Number (check the stubs in the test file, I got them by logging the grip and creating the object in the console).
I check if the `wrappedValue` property is in the preview object (and not only `if(object.preview.wrappedValue)` ), because it is possible to pass falsy value into the constructor (e.g. `new String(undefined)` , `new String(null)`, ... ) and we still want to show those.
Comment on attachment 8803829 [details]
Bug 1311426 - Handle Grip with wrapped value in Reps. ;

https://reviewboard.mozilla.org/r/87988/#review88458

> wrappedValue hold the value of the object for primitive object instanciated with the constructor.

I see, thanks.


R+ assuming Try is green.

Honza
Attachment #8803829 - Flags: review?(odvarko) → review+
Pushed by chevobbe.nicolas@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/657c36b85c68
Handle Grip with wrapped value in Reps. r=Honza;
https://hg.mozilla.org/mozilla-central/rev/657c36b85c68
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.