★ wanayoo — archive 1999 https://github.com/firefox-devtools/debugger/pull/7484Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke getter in the root object. #7484

Merged
merged 2 commits into from Dec 13, 2018
Merged

Conversation

@nchevobbe
Copy link
Member

@nchevobbe nchevobbe commented Dec 11, 2018

To invoke getter, we were retrieving the parent node
so we could access the getter. This works fine unless
the getter is itself somewhere in the prototype chain
and refers to a property set by an upper level.
This patch changes how we retrieve the context to
invoke the getter in to be the top-most, non-prototype
grip, which should cover this case.

Fixes #7397


Still WIP as I'm trying to find ways I could break it :)
@Loirooriol , would you have complex test cases I can test against to ensure this is a solid fix? :)

@Loirooriol
Copy link
Contributor

@Loirooriol Loirooriol commented Dec 12, 2018

For example,

({
  value: 1,
  obj: {
    value: 2,
    ["__proto__"]: {
      value: 3,
      __proto__: {
        value: 4,
        __proto__: {
          value: 5,
          get getter() { return this.value; },
        },
      },
    },
  },
})

I should be able to expand obj, __proto__, <prototype>, <prototype>, run the getter and get 3.

But of course __proto__ is still broken (#7223).

@nchevobbe nchevobbe removed the 📚 pr-wip label Dec 12, 2018
@nchevobbe
Copy link
Member Author

@nchevobbe nchevobbe commented Dec 12, 2018

I should be able to expand obj, proto, , , run the getter and get 3.

Good, I applied patch from #7489 on top of this patch and tested your test case:
image

I think this is ready to be reviewed.

I also added a mochitest in https://bugzilla.mozilla.org/show_bug.cgi?id=1513505 (TRY)

nchevobbe added 2 commits Dec 11, 2018
To invoke getter, we were retrieving the parent node
so we could access the getter. This works fine unless
the getter is itself somewhere in the prototype chain
and refers to a property set by an upper level.
This patch changes how we retrieve the context to
invoke the getter in to be the top-most, non-prototype
grip, which should cover this case.
@nchevobbe nchevobbe force-pushed the nchevobbe:getter-proto branch from c525ce5 to db90ba5 Dec 12, 2018
@nchevobbe nchevobbe requested a review from jasonLaster Dec 12, 2018
@nchevobbe
Copy link
Member Author

@nchevobbe nchevobbe commented Dec 12, 2018

how does that look Jason? (last patch before refactor :) I want to uplift this to beta if possible)

@nchevobbe nchevobbe merged commit 7f5da26 into firefox-devtools:master Dec 13, 2018
2 checks passed
2 checks passed
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nchevobbe nchevobbe deleted the nchevobbe:getter-proto branch Dec 13, 2018
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 13, 2018
This lands the fix done in the debugger Reps
for ObjectInspector (firefox-devtools/debugger#7484),
and add a test to ensure we don't regress this.
We take this as an opportunity to put some
object inspector helpers in head.js so we
don't repeat ourselves too much.

Differential Revision: https://phabricator.services.mozilla.com/D14240

--HG--
extra : moz-landing-system : lando
mykmelez pushed a commit to mykmelez/gecko that referenced this pull request Dec 14, 2018
This lands the fix done in the debugger Reps
for ObjectInspector (firefox-devtools/debugger#7484),
and add a test to ensure we don't regress this.
We take this as an opportunity to put some
object inspector helpers in head.js so we
don't repeat ourselves too much.

Differential Revision: https://phabricator.services.mozilla.com/D14240
jasonLaster pushed a commit that referenced this pull request Dec 14, 2018
* Invoke getter in the root object.

To invoke getter, we were retrieving the parent node
so we could access the getter. This works fine unless
the getter is itself somewhere in the prototype chain
and refers to a property set by an upper level.
This patch changes how we retrieve the context to
invoke the getter in to be the top-most, non-prototype
grip, which should cover this case.

* Remove unused getParentGripValue function
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 14, 2018
… a=RyanVM

This lands the fix done in the debugger Reps
for ObjectInspector (firefox-devtools/debugger#7484),
and add a test to ensure we don't regress this.
We take this as an opportunity to put some
object inspector helpers in head.js so we
don't repeat ourselves too much.

Differential Revision: https://phabricator.services.mozilla.com/D14240

--HG--
extra : source : 7e17aa956dc60adac6ad4c9bfc5414ff0b59c848
extra : histedit_source : abab3c5ed73d4984ae6e69378e47e663c7c954f9
jasonLaster pushed a commit that referenced this pull request Dec 20, 2018
* Invoke getter in the root object.

To invoke getter, we were retrieving the parent node
so we could access the getter. This works fine unless
the getter is itself somewhere in the prototype chain
and refers to a property set by an upper level.
This patch changes how we retrieve the context to
invoke the getter in to be the top-most, non-prototype
grip, which should cover this case.

* Remove unused getParentGripValue function
xeonchen pushed a commit to xeonchen/gecko that referenced this pull request Dec 21, 2018
… a=RyanVM

This lands the fix done in the debugger Reps
for ObjectInspector (firefox-devtools/debugger#7484),
and add a test to ensure we don't regress this.
We take this as an opportunity to put some
object inspector helpers in head.js so we
don't repeat ourselves too much.

Differential Revision: https://phabricator.services.mozilla.com/D14240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants