Closed Bug 1187956 Opened 9 years ago Closed 9 years ago

View source from SeaMonkey uses deprecated API

Categories

(SeaMonkey :: General, defect)

defect
Not set
normal

Tracking

(firefox42 affected)

RESOLVED FIXED
seamonkey2.39
Tracking Status
firefox42 --- affected

People

(Reporter: iannbugzilla, Assigned: iannbugzilla)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file, 2 obsolete files)

Error: DEPRECATION WARNING: The arguments you're passing to viewSource.xul are using an out-of-date API.
You may find more details about this deprecation at: https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications
chrome://global/content/viewSource.js 316 _loadViewSourceDeprecated
chrome://global/content/viewSource.js 302 onXULLoaded
chrome://global/content/viewSource.js 175 handleEvent
null 0 null
Assignee: nobody → iann_bugzilla
Status: NEW → ASSIGNED
Blocks: 1187964
Attached patch Port changes to SeaMonkey (obsolete) — Splinter Review
This ports the changes from:
* Bug 1025146 - Modernize viewSource.js to use a frame script
** https://hg.mozilla.org/mozilla-central/rev/13bf99d217bf
* Bug 1025146 - Make viewing the source of a page or frame via the context menu work with remote browsers
** http://hg.mozilla.org/mozilla-central/rev/28c41c53d0c2
Attachment #8639338 - Flags: review?(neil)
Comment on attachment 8639338 [details] [diff] [review]
Port changes to SeaMonkey

>+/**
>+ * Opens the View Source dialog for the source loaded in the root
>+ * top-level document of the browser. This is really just a
>+ * convenience wrapper around BrowserViewSourceOfDocument.
>+ *
>+ * @param aBrowser
>+ *        The browser that we want to load the source of.
>+ */
>+function BrowserViewSource(aBrowser) {
>+  BrowserViewSourceOfDocument({
>+    browser: aBrowser,
>+    outerWindowID: aBrowser.outerWindowID,
>+    URL: aBrowser.currentURI.spec,
>+  });
Why not call viewSourceUtils directly?

>   // Open new "view source" window with the frame's URL.
>   viewFrameSource: function() {
>-    BrowserViewSourceOfDocument(this.target.ownerDocument);
>+    BrowserViewSourceOfDocument({
>+      browser: this.browser,
>+      URL: gContextMenuContentData.docLocation,
>+      outerWindowID: gContextMenuContentData.frameOuterWindowID,
Our context menu content data doesn't include the outer window id yet.

>             window.openDialog( "chrome://global/content/viewSource.xul",
>-                               "_blank", "all,dialog=no", url,
>+                               "_blank", "all,dialog=no", {URL: url},
>                                mailCharacterSet);
This type of parameter ignores the character set, and because you don't provide a browser and outer window ID, it can't even try to grab the character set from the browser. (Always assuming that it's capable of grabbing the character set from the message pane...)
Attachment #8639338 - Flags: review?(neil) → review-
Attached patch Port changes to SeaMonkey v1.1 (obsolete) — Splinter Review
Changes from previous patch:
* BrowserViewSource now uses viewSourceUtils directly.
* Added frameOuterWindowID to context menu content data.
* Use getBrowser() to pass browser and outerWindowID to viewSource.xul
Attachment #8639338 - Attachment is obsolete: true
Attachment #8639603 - Flags: review?(neil)
Comment on attachment 8639603 [details] [diff] [review]
Port changes to SeaMonkey v1.1

>+function BrowserViewSourceOfDocument(aArgsOrDocument) {
[Ugh, why did Firefox have to have this weird dance?]

>+  let args;
>+
>+  if (aArgsOrDocument instanceof Document) {
>+    let doc = aArgsOrDocument;
...
>+  } else {
>+    args = aArgsOrDocument;
>+  }
I don't think you need three variables for the same thing. Just use aArgsOrDocument.

>+      this.frameOuterWindowID = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
>+                                   .getInterface(Components.interfaces.nsIDOMWindowUtils)
>+                                   .outerWindowID;
Don't need to set this; viewFrameSource only uses the other definition.

>+    BrowserViewSourceOfDocument({
Should be gViewSourceUtils again. (Sorry didn't notice you'd done it twice.)

r=me with the above fixed.
Attachment #8639603 - Flags: review?(neil) → review+
(In reply to neil@parkwaycc.co.uk from comment #4)
> Comment on attachment 8639603 [details] [diff] [review]
> Port changes to SeaMonkey v1.1
> 
> >+    BrowserViewSourceOfDocument({
> Should be gViewSourceUtils again. (Sorry didn't notice you'd done it twice.)
Only thought about this and the previous one, is that when/if the open view source in a browser tab is ported, would need to switch back to calling BrowserViewSourceOfDocument. I am tempted to have them both calling BrowserViewSourceOfDocument again, what do you think?
Flags: needinfo?(neil)
I'd create a new method (sorry can't think of a good name for it right now) which would handle the view source in a tab case. It would then just be a case of fixing up the three call sites.
Flags: needinfo?(neil)
Bug 1067325 - Add an option to view html source in a tab
Attachment #8639603 - Attachment is obsolete: true
Attachment #8641045 - Flags: review+
Comment on attachment 8641045 [details] [diff] [review]
Port changes to SeaMonkey v1.2 [Checked in: Comment 10]

a=me for CLOSED TREE comm-central
Comment on attachment 8641045 [details] [diff] [review]
Port changes to SeaMonkey v1.2 [Checked in: Comment 10]

http://hg.mozilla.org/comm-central/rev/4d05dd6f2b9f
Attachment #8641045 - Attachment description: Port changes to SeaMonkey v1.2 → Port changes to SeaMonkey v1.2 [Checked in: Comment 10]
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.39
Blocks: 1190179
Blocks: 1163707
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: