Closed Bug 881083 Opened 7 years ago Closed 6 years ago

[Multizilla] Add a "Validate this page" entry to the Web Development submenu.

Categories

(SeaMonkey :: UI Design, defect)

defect
Not set

Tracking

(seamonkey2.22 fixed)

RESOLVED FIXED
seamonkey2.22
Tracking Status
seamonkey2.22 --- fixed

People

(Reporter: philip.chee, Assigned: philip.chee)

References

(Blocks 1 open bug)

Details

(Whiteboard: parity-multizilla)

Attachments

(1 file, 1 obsolete file)

Multizilla had an option to validate the current content page with the w3c html validator. I think this is useful enough to add to SeaMonkey. Patch to follow.
Attached patch Patch v1.0 WIP (obsolete) — Splinter Review
> +++ b/suite/common/contentAreaClick.js
....
> -      openNewWindowWith(href, doc);
> +      if (window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
> +                .getInterface(Components.interfaces.nsIWebNavigation)
> +                .QueryInterface(Components.interfaces.nsILoadContext)
> +                .usePrivateBrowsing)
> +        openNewPrivateWith(href, doc);
> +      else
> +        openNewWindowWith(href, doc);

PB leak!

> +++ b/suite/browser/webDeveloperOverlay.js
> +    var checkURL = "http://validator.w3.org/check?" +
> +                   "charset=%28detect+automatically%29&doctype=Inline&uri=" +
> +                   encodeURIComponent(uri.spec);

TODO move checkURL to a localized string pref.

> +    if (!openNewTabOrWindow(aEvent, checkURL, getBrowser().contentDocument))
How to get openNewTabOrWindow() to open the tab/window in the foreground?

> +      getBrowser().addTab(checkURL, { referrerURI: uri, focusNewTab: true });
Fallback.

> +  initOverlay: function initOverlay(aEvent) {
> +    window.removeEventListener("load", gWebDeveloper.initOverlay, false);

I should remove the event listener from safeBrowsingOverlay.js as well shouldn't I?

> +  <menupopup id="toolsPopup">
> +    <menuitem id="validatePage"
Should I put this under the Web Development menu or directly on the main Tools menu?
TODO add the CSS checker and link checker from Bug 102952.

While filing this bug, Bugzilla's duplicate checker helpfully pointed me to Bug 102952 ([RFE] Validate HTML should be available in the browser) which was WONTFIXed.
Attachment #760215 - Flags: feedback?(neil)
Attachment #760215 - Flags: feedback?(iann_bugzilla)
Blocks: 102952
(In reply to Philip Chee from comment #1)
> > +      if (window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
> > +                .getInterface(Components.interfaces.nsIWebNavigation)
> > +                .QueryInterface(Components.interfaces.nsILoadContext)
> > +                .usePrivateBrowsing)
> > +        openNewPrivateWith(href, doc);
> > +      else
> > +        openNewWindowWith(href, doc);
> 
> PB leak!

[It's safe to use if (gPrivate) here.]

> > +    if (!openNewTabOrWindow(aEvent, checkURL, getBrowser().contentDocument))
> How to get openNewTabOrWindow() to open the tab/window in the foreground?
Windows always open in the foreground, tabs depend on the shift key.
Changes since the last patch:
1. use gPrivate in openNewTabOrWindow().
2. Moved checkURL to a localized string pref.
Attachment #760215 - Attachment is obsolete: true
Attachment #760215 - Flags: feedback?(neil)
Attachment #760215 - Flags: feedback?(iann_bugzilla)
Attachment #761029 - Flags: review?(neil)
Attachment #761029 - Flags: feedback?(iann_bugzilla)
Attachment #761029 - Flags: feedback?(iann_bugzilla) → review+
Attachment #761029 - Flags: review?(neil) → feedback?(neil)
Pushed to comm-central:
http://hg.mozilla.org/comm-central/rev/df887839a810
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.22
Comment on attachment 761029 [details] [diff] [review]
Patch v1.1 address feedback.

>+    if (!openNewTabOrWindow(aEvent, checkURL, getBrowser().contentDocument))
>+      getBrowser().addTab(checkURL, { referrerURI: uri, focusNewTab: true });
openUILink is a better fit.

>+  initMenuItem: function initMenuItem() {
>+    var menuitem = document.getElementById("validatePage");
>+    var uri = getBrowser().currentURI;
It looks as if your overlay doesn't apply to the Mac hidden window, which (if true) is good.

>+  initOverlay: function initOverlay(aEvent) {
[This of course gets called as a global method, which is why you have to use gWebDeveloper rather than this... it's fortunate that you only need to refer to it twice.]

>+      if (gPrivate)
>+        openNewPrivateWith(href, doc);
>+      else
>+        openNewWindowWith(href, doc);
I guess this really ought to land on branches...
Attachment #761029 - Flags: feedback?(neil) → feedback-
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 896384
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.