Closed
Bug 1434563
Opened 6 years ago
Closed 6 years ago
keys and values jsterm helpers override global content functions
Categories
(DevTools :: Console, defect, P1)
DevTools
Console
Tracking
(firefox60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 fixed)
RESOLVED
FIXED
Firefox 63
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
(Whiteboard: [boogaloo-mvp])
Attachments
(1 file)
Steps to reproduce: 1. Go to data:text/html,keys/values<script>values = () => "a";keys = () => 1;</script> 2. Open the console 3. Evaluate `keys()` 4. Evaluate `values()` Expected results: I see 2 lines, with "a" and `1` representing the result of the keys and values function call Actual results: I get 2 error messages: "TypeError: can't convert undefined to object" This is because the helpers override the global content functions. We already had the same issue with $/$$ helpers and fixed it: https://searchfox.org/mozilla-central/rev/c56f656febb1aa58c72b218699e24a76425bd284/devtools/server/actors/webconsole.js#1374-1397 We should make sure we do the same for all the helpers we provide in the jsterm.
Updated•6 years ago
|
Priority: -- → P2
Whiteboard: [boogaloo-mvp]
Updated•6 years ago
|
Product: Firefox → DevTools
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P2 → P1
Assignee | ||
Comment 1•6 years ago
|
||
If the content page sets a global keys, values, , … function, calling them in the jsterm won't work because the helpers we provide will override them. This is very disturbing when debugging code, and this patch fixes this issue by looking at all the registered helpers and clearing helpers bindings if a function with the same name as an helper exists in the content page. This is not done for the print helper though, since the print function on window always exists. We also take this as an opportunity to only return unique item in the autocomplete server function so we don't show a function twice in the popup if it is defined in content and as an helper. The test that was asserting this behaviour for $ and $$ is renamed and modified to test all the helpers. MozReview-Commit-ID: 1bTliGUb39U
Assignee | ||
Comment 2•6 years ago
|
||
TRY looks okay: https://treeherder.mozilla.org/#/jobs?repo=try&revision=37bdfcba41cd77792736355f930cb933bc044b18
Assignee | ||
Comment 3•6 years ago
|
||
Comment on attachment 8992354 [details] Bug 1434563 - Do not execute helper if the function is defined in content; r=Honza. Manually setting reviewer here since Phabricator does not seem to do it automatically
Attachment #8992354 -
Flags: review?(odvarko)
Comment 4•6 years ago
|
||
Comment on attachment 8992354 [details] Bug 1434563 - Do not execute helper if the function is defined in content; r=Honza. Jan Honza Odvarko [:Honza] has approved the revision. https://phabricator.services.mozilla.com/D2156
Attachment #8992354 -
Flags: review+
Updated•6 years ago
|
Attachment #8992354 -
Flags: review?(odvarko)
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9b6c65bb4719 Do not execute helper if the function is defined in content; r=Honza.
Comment 6•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/9b6c65bb4719
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Updated•6 years ago
|
status-firefox61:
--- → wontfix
status-firefox62:
--- → wontfix
You need to log in
before you can comment on or make changes to this bug.
Description
•