Open Bug 1163707 Opened 10 years ago Updated 2 years ago

Move comm-central apps off of deprecated ViewSource APIs

Categories

(Thunderbird :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: mconley, Unassigned)

References

Details

Bug 1025146 refactored the way View Source works so as to support browsers running out of process. While doing that, I tried to support the old APIs that were being used so as not to break other apps, but those APIs have also been deprecated. We should get SeaMonkey, Thunderbird and Instantbird off of those APIs sooner rather than later. https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications
There is also a warning in Error console whenever the View source is used: 16:46:07.867 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 339 _loadViewSourceDeprecated chrome://global/content/viewSource.js 319 onXULLoaded chrome://global/content/viewSource.js 185 handleEvent 1 Deprecated.jsm:79 warning resource://gre/modules/Deprecated.jsm:79:5 _loadViewSourceDeprecated chrome://global/content/viewSource.js:339:5 onXULLoaded chrome://global/content/viewSource.js:319:14 handleEvent chrome://global/content/viewSource.js:185:9 This warning is there for at least a year now. We should try to migrate it before m-c removes the old APIs. mconley, can you help us in the transition? We use this code so show the source of all selected messages: for (var i = 0; i < numMessages; i++) { // Now, we need to get a URL from a URI var url = MailServices.mailSession.ConvertMsgURIToMsgURL(messages[i], msgWindow); // Strip out the message-display parameter to ensure that attached emails // display the message source, not the processed HTML. url = url.replace(/type=application\/x-message-display&/, ""); window.openDialog("chrome://global/content/viewSource.xul", "_blank", "all,dialog=no", {URL: url, browser: browser, outerWindowID: browser.outerWindowID}); } The viewSource.xul and viewSource.js seem to come from m-c.
Flags: needinfo?(mconley)
Reading viewSource.js, the old API is passing all the arguments as a string. But with the pasted code, we pass the arguments as an object, which is the new API. So what is wrong?
Right, Seamonkey and Thunderbird are already converted via bug 1187956 and 1187964. And indeed pressing Ctrl-U on a message in Thunderbird does NOT produce the warning. When I see the warning in comment 1, it is when I click a filename in the Browser Console so show the source line where an error occurred. So that seems to come from m-c ? I see 2 suspicious calls to viewSouce.xul seemingly using the old API (both in /mozilla): https://dxr.mozilla.org/comm-central/rev/9b13e3ad66cf993b30ba6e40e144a7d6428f43c0/mozilla/extensions/inspector/resources/content/jsutil/commands/baseCommands.js#158 https://dxr.mozilla.org/comm-central/rev/833f84d0d5c729054a3aa8b3f34735f56fe6436b/mozilla/toolkit/components/viewsource/content/viewSourceUtils.js#165 mconley, can you confirm?
Depends on: 1187956, 1187964
OS: Unspecified → All
Hardware: Unspecified → All
Inspector is DOM Inspector. If I find some time I will look into it.
(In reply to :aceman from comment #3) > I see 2 suspicious calls to viewSouce.xul seemingly using the old API (both > in /mozilla): > https://dxr.mozilla.org/comm-central/rev/ > 9b13e3ad66cf993b30ba6e40e144a7d6428f43c0/mozilla/extensions/inspector/ > resources/content/jsutil/commands/baseCommands.js#158 > https://dxr.mozilla.org/comm-central/rev/ > 833f84d0d5c729054a3aa8b3f34735f56fe6436b/mozilla/toolkit/components/ > viewsource/content/viewSourceUtils.js#165 > > mconley, can you confirm? Yep, looks like you've found it. Kinda disappointing that we have that lingering deprecated use in viewSourceUtils.js. :/ Wonder how I missed that.
Flags: needinfo?(mconley)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.