Closed
Bug 901517
Opened 11 years ago
Closed 11 years ago
Observable Object: use EventEmitter.decorate and fix array issue
Categories
(DevTools Graveyard :: WebIDE, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 26
People
(Reporter: paul, Assigned: paul)
References
Details
Attachments
(2 files, 1 obsolete file)
4.64 KB,
patch
|
ochameau
:
review+
|
Details | Diff | Splinter Review |
4.78 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•11 years ago
|
||
To easily inherit from ObservableObject, it's better to use EventEmitter.decorate. Also, we were returning the wrong path sometimes.
Attachment #787451 -
Flags: review?(poirot.alex)
Comment 2•11 years ago
|
||
Comment on attachment 787451 [details] [diff] [review] Patch v1 Review of attachment 787451 [details] [diff] [review]: ----------------------------------------------------------------- Also I'm seing what looks like strict JS errors, can you set strict mode and fix eventual exeptions. (Like `path` not being declared anywhere here http://mxr.mozilla.org/mozilla-central/source/browser/devtools/shared/observable-object.js#107) ::: browser/devtools/shared/observable-object.js @@ -43,4 @@ > > function isObject(value) { > return Object(value) === value; > } I think that's a bad way to check for objects. I'm expecting to see failure if we get cross compartments objects. Could you use this pattern instead? http://mxr.mozilla.org/mozilla-central/source/testing/specialpowers/content/specialpowersAPI.js?force=1#48 (This code has been written by bholley... I trust him when it comes to wrappers ;)) @@ -70,5 @@ > unwrap: function(target, key, value) { > if (!isObject(value) || !this._wrappers.has(value)) { > return [value, this._paths.get(target).concat(key)]; > } > - return [this._wrappers.get(value), this._paths.get(value)]; I'm new to ObservableObject implementation, I do not easily what it fixes, what about having a test covering this fix?
Attachment #787451 -
Flags: review?(poirot.alex)
Assignee | ||
Comment 3•11 years ago
|
||
(In reply to Alexandre Poirot (:ochameau) from comment #2) > Also I'm seing what looks like strict JS errors, can you set strict mode and > fix eventual exeptions. > (Like `path` not being declared anywhere here > http://mxr.mozilla.org/mozilla-central/source/browser/devtools/shared/ > observable-object.js#107) Addressed ("use strict"). > ::: browser/devtools/shared/observable-object.js > @@ -43,4 @@ > > > > function isObject(value) { > > return Object(value) === value; > > } > > I think that's a bad way to check for objects. > I'm expecting to see failure if we get cross compartments objects. > Could you use this pattern instead? > http://mxr.mozilla.org/mozilla-central/source/testing/specialpowers/content/ > specialpowersAPI.js?force=1#48 > (This code has been written by bholley... I trust him when it comes to > wrappers ;)) wut? How can it be bad? > @@ -70,5 @@ > > unwrap: function(target, key, value) { > > if (!isObject(value) || !this._wrappers.has(value)) { > > return [value, this._paths.get(target).concat(key)]; > > } > > - return [this._wrappers.get(value), this._paths.get(value)]; > > I'm new to ObservableObject implementation, I do not easily what it fixes, > what about having a test covering this fix? We were getting an exception when re-using existing wrapped objects into new properties. I have added some more tests to cover this.
Attachment #787451 -
Attachment is obsolete: true
Attachment #788918 -
Flags: review?(poirot.alex)
Comment 4•11 years ago
|
||
Comment on attachment 788918 [details] [diff] [review] Patch v1.1 Review of attachment 788918 [details] [diff] [review]: ----------------------------------------------------------------- > > ::: browser/devtools/shared/observable-object.js > > @@ -43,4 @@ > > > > > > function isObject(value) { > > > return Object(value) === value; > > > } > > > > I think that's a bad way to check for objects. > > I'm expecting to see failure if we get cross compartments objects. > > Could you use this pattern instead? > > http://mxr.mozilla.org/mozilla-central/source/testing/specialpowers/content/ > > specialpowersAPI.js?force=1#48 > > (This code has been written by bholley... I trust him when it comes to > > wrappers ;)) > > wut? How can it be bad? If you have a wrapper at some point, your isObject function will behave incorrectly. You can see that by executing this in the (old) error console: JObject(content) == content false Please tweak this method, that would be unfortunate to loose time on wrapper issues...
Attachment #788918 -
Flags: review?(poirot.alex) → review+
Assignee | ||
Comment 5•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Whiteboard: [land-in-fx-team]
Assignee | ||
Updated•11 years ago
|
Whiteboard: [land-in-fx-team]
Assignee | ||
Comment 6•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=fdf537f42bb5
Assignee | ||
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/fde7ed54c2cb
Whiteboard: [fixed-in-fx-team]
Comment 8•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fde7ed54c2cb
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 26
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•4 years ago
|
Product: DevTools → DevTools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•