Closed
Bug 1465952
Opened 7 years ago
Closed 7 years ago
Make about:support display the parsed policies json
Categories
(Firefox :: Enterprise Policies, enhancement, P2)
Firefox
Enterprise Policies
Tracking
()
RESOLVED
FIXED
Firefox 63
People
(Reporter: Felipe, Assigned: kanika16047)
References
Details
Attachments
(1 file)
Before we have a nice and functional about:policies page, there's an easy intermediate step that we can make to fulfill the gap.
about:support currently displays the status of the policy engine (see "Enterprise Policies" in about:support).
We could make that a clickable link that displays the parsed JSON in a new window using the built-in JSON viewer that we have.
This only requires bug 1452533 and bug 1465950 to be implemented.
To open the JSON viewer I have some code that I experimented with a while ago that I saved:
```
> let jsonblob = new Blob([JSON.stringify({foo: "bar"})], {type:"application/json"});
> let jsonurl = URL.createObjectURL(jsonblob);
> window.open(jsonurl);
```
| Reporter | ||
Updated•7 years ago
|
Priority: -- → P2
| Assignee | ||
Updated•7 years ago
|
Assignee: nobody → ksaini
| Assignee | ||
Updated•7 years ago
|
Status: NEW → ASSIGNED
| Comment hidden (mozreview-request) |
| Reporter | ||
Comment 2•7 years ago
|
||
| mozreview-review | ||
Comment on attachment 8987819 [details]
Bug 1465952 - about:support displays JSON of successfully parsed policies
https://reviewboard.mozilla.org/r/253096/#review260240
::: toolkit/content/aboutSupport.js:98
(Diff revision 1)
> default:
> policiesText = strings.GetStringFromName("policies.error");
> break;
> }
> - $("policies-status").textContent = policiesText;
> + $("policies-status").textContent = "(" + policiesText + ") ";
> + let aboutPolicies = $.new("a", "about:policies", null, {href: "about:policies"});
it's weird that this button has both the href to about:policies, and the click event listener.
Before we have a functional about:policies page, let's use a different text for this link.
I think you can just make the `policiesText` link be clickable. In other words, <a>policiesText</a>
But I think it'd be nice this was only a clickable link if the status of the engine is active. I know it makes things a tad more complicated, but it will look better.
::: toolkit/content/aboutSupport.js:100
(Diff revision 1)
> break;
> }
> - $("policies-status").textContent = policiesText;
> + $("policies-status").textContent = "(" + policiesText + ") ";
> + let aboutPolicies = $.new("a", "about:policies", null, {href: "about:policies"});
> + aboutPolicies.addEventListener("click", function(event) {
> + let activePoliciesJsonBlob = new Blob([JSON.stringify(Services.policies.getActivePolicies())], {type: "application/json"});
getActivePolicies() returns an object like this:
`{ BlockAboutSupport: true, BlockAboutConfig: true }`
(which is a fine behavior for getActivePolicies)
but the input json that the user provided has this wrapped in a policies object, like so:
`{ policies: { ... } }`
So it would be nice if you did the same here before stringifying, in order to make it look like the input given by the user.
::: toolkit/content/aboutSupport.js:101
(Diff revision 1)
> + let jsonUrl = URL.createObjectURL(activePoliciesJsonBlob);
> + window.open(jsonUrl);
after calling window.open, you should call URL.revokeObjectURL with the jsonUrl var.
Attachment #8987819 -
Flags: review?(felipc)
| Comment hidden (mozreview-request) |
| Reporter | ||
Comment 4•7 years ago
|
||
| mozreview-review | ||
Comment on attachment 8987819 [details]
Bug 1465952 - about:support displays JSON of successfully parsed policies
https://reviewboard.mozilla.org/r/253096/#review260368
::: toolkit/content/aboutSupport.js:97
(Diff revision 2)
>
> default:
> policiesText = strings.GetStringFromName("policies.error");
> break;
> }
> + if (policiesText == "Active") {
checking for the text "Active" here won't work for Firefox in other languages. So instead it should use the data.policiesStatus value.
nit: add a newline before this if
::: toolkit/content/aboutSupport.js:102
(Diff revision 2)
> + if (policiesText == "Active") {
> + let activePolicies = $.new("a", policiesText);
> + activePolicies.addEventListener("click", function(event) {
> + let activePoliciesJson = {};
> + activePoliciesJson.policies = Services.policies.getActivePolicies();
> + let activePoliciesJsonBlob = new Blob([JSON.stringify(activePoliciesJson)], {type: "application/json"});
nit: try to break this line into multiple ones so that it doesn't go beyond 100 chars
::: toolkit/content/aboutSupport.js:103
(Diff revision 2)
> + let activePolicies = $.new("a", policiesText);
> + activePolicies.addEventListener("click", function(event) {
> + let activePoliciesJson = {};
> + activePoliciesJson.policies = Services.policies.getActivePolicies();
> + let activePoliciesJsonBlob = new Blob([JSON.stringify(activePoliciesJson)], {type: "application/json"});
> + let jsonUrl = URL.createObjectURL(activePoliciesJsonBlob);
nit: name this variable jsonURL
Attachment #8987819 -
Flags: review?(felipc)
| Comment hidden (mozreview-request) |
| Reporter | ||
Comment 6•7 years ago
|
||
| mozreview-review | ||
Comment on attachment 8987819 [details]
Bug 1465952 - about:support displays JSON of successfully parsed policies
https://reviewboard.mozilla.org/r/253096/#review260838
Attachment #8987819 -
Flags: review?(felipc) → review+
Pushed by felipc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/1cb2bf41a61f
about:support displays JSON of successfully parsed policies r=Felipe
Comment 8•7 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Updated•7 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•