Closed Bug 989777 Opened 10 years ago Closed 10 years ago

Move inline scripts for SeaMonkey's aboutPrivateBrowsing.xul page into a separate file

Categories

(SeaMonkey :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.28

People

(Reporter: rsx11m.pub, Assigned: rsx11m.pub)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #960566 +++

> With the current plan to harden the security of Firefox, we want to
> disallow internal privileged pages to use inline JavaScript.

The "about:privatebrowsing" page is a privileged page and has some inline JavaScript for onLoad() in the XUL code. There are also three buttons in this page (i.e., privatebrowsingpage.learnmore, privatebrowsingpage.close, and privatebrowsingpage.private), which have "oncommand=" attributes that need to be translated into event handlers to get rid of the inline scripts.
Attached patch Proposed patch (obsolete) — Splinter Review
This patch moves the contents of onLoad() into a "DOMContentLoaded" event listener that also adds three "command" event listeners for the buttons.

The onLoad() JavaScript code itself hasn't changed from the previous version.
As a (necessary) secondary fix, all buttons now also have proper ids.

Having seen similar definitions with and without the (event) argument in the function argument, I'm not sure where it's necessary and where it is redundant. Also, the optional useCapture defaults to false which seems to be fine here.
Attachment #8403702 - Flags: review?(neil)
Comment on attachment 8403702 [details] [diff] [review]
Proposed patch

Seems reasonable but can you use window.onload like you did in the other bug?

Also you can use double quotes in the .js file (obviously single quotes are preferred in event handler attributes).

(You don't need the event parameter if as here you don't use it.)
(In reply to neil@parkwaycc.co.uk from comment #2)
> Seems reasonable but can you use window.onload like you did in the other bug?

I've seen window.onload being used with XHTML pages only and the more complicated form with XUL, thus I assumed that it wouldn't work here - yet it does, hence so changed.

> Also you can use double quotes in the .js file (obviously single quotes are
> preferred in event handler attributes).

Quotes flipped to preferred style.

> (You don't need the event parameter if as here you don't use it.)

Function arguments removed.
Attachment #8403702 - Attachment is obsolete: true
Attachment #8403702 - Flags: review?(neil)
Attachment #8404311 - Flags: review?(neil)
Attachment #8404311 - Flags: review?(neil) → review+
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/80a530af380d
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: