Closed
Bug 1444853
Opened 7 years ago
Closed 7 years ago
Setting permissionsText in the site permissions dialog can be simplified
Categories
(Firefox :: Settings UI, enhancement, P5)
Tracking
()
RESOLVED
FIXED
Firefox 61
People
(Reporter: johannh, Assigned: accakks, Mentored)
Details
(Keywords: good-first-bug)
Attachments
(1 file)
https://searchfox.org/mozilla-central/rev/a70da6775d5341a9cca86bf1572a5e3534909153/browser/components/preferences/sitePermissions.js#53
Instead of iterating over child nodes and deleting them, then making a new textNode and inserting it, we can just use .textContent to override the intro text directly.
| Assignee | ||
Comment 1•7 years ago
|
||
Would like to work on this!
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 6•7 years ago
|
||
| mozreview-review | ||
Comment on attachment 8958841 [details]
Bug 1444853 - Setting permissionsText in the site permissions dialog can be simplified
https://reviewboard.mozilla.org/r/227726/#review233770
Please make these changes and request review again.
It looks like you're making a few linting errors(extra whitespaces, extra new lines, etc). That can be handled by running the './mach eslint <path_to_file>' command. Before submmiting your changeset for review, it's always a good idea to run eslint and correct all the linting errors you have made. :)
::: browser/components/preferences/sitePermissions.js:54
(Diff revision 3)
> - let permissionsText = document.getElementById("permissionsText");
> - while (permissionsText.hasChildNodes())
> - permissionsText.firstChild.remove();
> - permissionsText.appendChild(document.createTextNode(params.introText));
>
> + let permissionsText = document.getElementById("permissionsText").textContent;
Please remove the whitespace at the end of this line
::: browser/components/preferences/sitePermissions.js:54
(Diff revision 3)
> - let permissionsText = document.getElementById("permissionsText");
> - while (permissionsText.hasChildNodes())
> - permissionsText.firstChild.remove();
> - permissionsText.appendChild(document.createTextNode(params.introText));
>
> + let permissionsText = document.getElementById("permissionsText").textContent;
This line should be left as it is:
let permissionsText = document.getElementById("permissionsText");
When you do this, you're bringing the DOM element with "permissionsText" as id and putting it in the permissionsText variable for later use.
.textContent is just a property that you can use on some XUL elements like label, description, etc to set text.
::: browser/components/preferences/sitePermissions.js:55
(Diff revision 3)
> - while (permissionsText.hasChildNodes())
> - permissionsText.firstChild.remove();
> - permissionsText.appendChild(document.createTextNode(params.introText));
>
> + let permissionsText = document.getElementById("permissionsText").textContent;
> + document.getElementById("permissionsText").textContent=params.introText;
Here you can just do:
permissionText.textContent = params.introText;
Since you have already fetched the DOM element and stored it in the permissionsText variable in the above line, you don't have to fetch it again to set introText.
::: browser/components/preferences/sitePermissions.js:56
(Diff revision 3)
> - permissionsText.firstChild.remove();
> - permissionsText.appendChild(document.createTextNode(params.introText));
>
> + let permissionsText = document.getElementById("permissionsText").textContent;
> + document.getElementById("permissionsText").textContent=params.introText;
> +
Please remove all the extra new lines you have added here
Attachment #8958841 -
Flags: review?(prathikshaprasadsuman) → review-
| Comment hidden (mozreview-request) |
Comment 8•7 years ago
|
||
| mozreview-review | ||
Comment on attachment 8958841 [details]
Bug 1444853 - Setting permissionsText in the site permissions dialog can be simplified
https://reviewboard.mozilla.org/r/227726/#review233916
Looks great, thanks!
Now this needs a run on our try server, to check if tests are still green after this change
(https://wiki.mozilla.org/ReleaseEngineering/TryServer). I'll do that for you this time,
but in the future you might want to get your own try access.
Once we have a successful try run, you may set the checkin-needed flag to get your patch checked in.
Attachment #8958841 -
Flags: review?(prathikshaprasadsuman) → review+
| Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6465338139d2
Setting permissionsText in the site permissions dialog can be simplified r=prathiksha
Keywords: checkin-needed
Comment 10•7 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Updated•7 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•