From c28c5b704fb3f3af6e7846abd73f63da1e35921f Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 07:52:31 -0500 Subject: Issue N/A - Undeprecate viewSource.xul's original API --- .../viewsource/content/viewSource-content.js | 14 +++--- .../components/viewsource/content/viewSource.js | 57 +++------------------- .../viewsource/content/viewSourceUtils.js | 18 +++---- 3 files changed, 21 insertions(+), 68 deletions(-) (limited to 'toolkit') diff --git a/toolkit/components/viewsource/content/viewSource-content.js b/toolkit/components/viewsource/content/viewSource-content.js index 4efa1e9525..fa1dd19f1a 100644 --- a/toolkit/components/viewsource/content/viewSource-content.js +++ b/toolkit/components/viewsource/content/viewSource-content.js @@ -43,7 +43,7 @@ var ViewSourceContent = { */ messages: [ "ViewSource:LoadSource", - "ViewSource:LoadSourceDeprecated", + "ViewSource:LoadSourceOriginal", "ViewSource:LoadSourceWithSelection", "ViewSource:GoToLine", "ViewSource:ToggleWrapping", @@ -131,8 +131,8 @@ var ViewSourceContent = { this.viewSource(data.URL, data.outerWindowID, data.lineNumber, data.shouldWrap); break; - case "ViewSource:LoadSourceDeprecated": - this.viewSourceDeprecated(data.URL, objects.pageDescriptor, data.lineNumber, + case "ViewSource:LoadSourceOriginal": + this.viewSourceOriginal(data.URL, objects.pageDescriptor, data.lineNumber, data.forcedCharSet); break; case "ViewSource:LoadSourceWithSelection": @@ -245,7 +245,7 @@ var ViewSourceContent = { }, /** - * Called when the parent is using the deprecated API for viewSource.xul. + * Called when the parent is using the original API for viewSource.xul. * This function will throw if it's called on a remote browser. * * @param URL (required) @@ -260,11 +260,11 @@ var ViewSourceContent = { * @param forcedCharSet (optional) * The document character set to use instead of the default one. */ - viewSourceDeprecated(URL, pageDescriptor, lineNumber, forcedCharSet) { + viewSourceOriginal(URL, pageDescriptor, lineNumber, forcedCharSet) { // This should not be called if this frame script is running // in a content process! if (Services.appinfo.processType != Services.appinfo.PROCESS_TYPE_DEFAULT) { - throw new Error("ViewSource deprecated API should not be used with " + + throw new Error("ViewSource original API should not be used with " + "remote browsers."); } @@ -272,7 +272,7 @@ var ViewSourceContent = { }, /** - * Common utility function used by both the current and deprecated APIs + * Common utility function used by both the current and orginal APIs * for loading source. * * @param URL (required) diff --git a/toolkit/components/viewsource/content/viewSource.js b/toolkit/components/viewsource/content/viewSource.js index 873e1bcdb3..234ffefc38 100644 --- a/toolkit/components/viewsource/content/viewSource.js +++ b/toolkit/components/viewsource/content/viewSource.js @@ -13,8 +13,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu", "resource://gre/modules/CharsetMenu.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", - "resource://gre/modules/Deprecated.jsm"); [ ["gBrowser", "content"], @@ -260,7 +258,7 @@ ViewSourceChrome.prototype = { * lineNumber (optional): * The line number to focus on once the source is loaded. * - * The deprecated API has the opener pass in a number of arguments: + * The original API has the opener pass in a number of arguments: * * arg[0] - URL string. * arg[1] - Charset value string in the form 'charset=xxx'. @@ -305,8 +303,8 @@ ViewSourceChrome.prototype = { } if (typeof window.arguments[0] == "string") { - // We're using the deprecated API - return this._loadViewSourceDeprecated(window.arguments); + // We're using the original API + return this._loadViewSourceOriginal(window.arguments); } // We're using the modern API, which allows us to view the @@ -322,13 +320,10 @@ ViewSourceChrome.prototype = { }, /** - * This is the deprecated API for viewSource.xul, for old-timer consumers. + * This is the original API for viewSource.xul, for old-timer consumers. * This API might eventually go away. */ - _loadViewSourceDeprecated(aArguments) { - Deprecated.warning("The arguments you're passing to viewSource.xul " + - "are using an out-of-date API.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); + _loadViewSourceOriginal(aArguments) { // Parse the 'arguments' supplied with the dialog. // arg[0] - URL string. // arg[1] - Charset value in the form 'charset=xxx'. @@ -344,7 +339,7 @@ ViewSourceChrome.prototype = { } if (this.browser.isRemoteBrowser) { - throw new Error("Deprecated view source API should not use a remote browser."); + throw new Error("Original view source API should not use a remote browser."); } let forcedCharSet; @@ -352,7 +347,7 @@ ViewSourceChrome.prototype = { forcedCharSet = aArguments[1].split("=")[1]; } - this.sendAsyncMessage("ViewSource:LoadSourceDeprecated", { + this.sendAsyncMessage("ViewSource:LoadSourceOriginal", { URL: aArguments[0], lineNumber: aArguments[3], forcedCharSet, @@ -787,49 +782,31 @@ function ViewSourceSavePage() gPageLoader); } -// Below are old deprecated functions and variables left behind for +// Below are original functions and variables left behind for // compatibility reasons. These will be removed soon via bug 1159293. this.__defineGetter__("gLastLineFound", function () { - Deprecated.warning("gLastLineFound is deprecated - please use " + - "viewSourceChrome.lastLineFound instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); return viewSourceChrome.lastLineFound; }); function onLoadViewSource() { - Deprecated.warning("onLoadViewSource() is deprecated - please use " + - "viewSourceChrome.onXULLoaded() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.onXULLoaded(); } function isHistoryEnabled() { - Deprecated.warning("isHistoryEnabled() is deprecated - please use " + - "viewSourceChrome.historyEnabled instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); return viewSourceChrome.historyEnabled; } function ViewSourceClose() { - Deprecated.warning("ViewSourceClose() is deprecated - please use " + - "viewSourceChrome.close() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.close(); } function ViewSourceReload() { - Deprecated.warning("ViewSourceReload() is deprecated - please use " + - "viewSourceChrome.reload() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.reload(); } function getWebNavigation() { - Deprecated.warning("getWebNavigation() is deprecated - please use " + - "viewSourceChrome.webNav instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); // The original implementation returned null if anything threw during // the getting of the webNavigation. try { @@ -840,45 +817,27 @@ function getWebNavigation() } function viewSource(url) { - Deprecated.warning("viewSource() is deprecated - please use " + - "viewSourceChrome.loadURL() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.loadURL(url); } function ViewSourceGoToLine() { - Deprecated.warning("ViewSourceGoToLine() is deprecated - please use " + - "viewSourceChrome.promptAndGoToLine() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.promptAndGoToLine(); } function goToLine(line) { - Deprecated.warning("goToLine() is deprecated - please use " + - "viewSourceChrome.goToLine() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.goToLine(line); } function BrowserForward(aEvent) { - Deprecated.warning("BrowserForward() is deprecated - please use " + - "viewSourceChrome.goForward() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.goForward(); } function BrowserBack(aEvent) { - Deprecated.warning("BrowserBack() is deprecated - please use " + - "viewSourceChrome.goBack() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.goBack(); } function UpdateBackForwardCommands() { - Deprecated.warning("UpdateBackForwardCommands() is deprecated - please use " + - "viewSourceChrome.updateCommands() instead.", - "https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications"); viewSourceChrome.updateCommands(); } diff --git a/toolkit/components/viewsource/content/viewSourceUtils.js b/toolkit/components/viewsource/content/viewSourceUtils.js index 5752683e99..11b39ca54b 100644 --- a/toolkit/components/viewsource/content/viewSourceUtils.js +++ b/toolkit/components/viewsource/content/viewSourceUtils.js @@ -15,8 +15,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ViewSourceBrowser", "resource://gre/modules/ViewSourceBrowser.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", - "resource://gre/modules/Deprecated.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Services", @@ -51,12 +49,12 @@ var gViewSourceUtils = { * lineNumber (optional): * The line number to focus on once the source is loaded. * - * @param aPageDescriptor (deprecated, optional) + * @param aPageDescriptor (optional) * Accepted for compatibility reasons, but is otherwise ignored. - * @param aDocument (deprecated, optional) + * @param aDocument (optional) * The content document we would like to view the source of. This * function will throw if aDocument is a CPOW. - * @param aLineNumber (deprecated, optional) + * @param aLineNumber (optional) * The line number to focus on once the source is loaded. */ viewSource: function(aArgsOrURL, aPageDescriptor, aDocument, aLineNumber) @@ -213,12 +211,12 @@ var gViewSourceUtils = { * lineNumber (optional): * The line number to focus on once the source is loaded. * - * @param aPageDescriptor (deprecated, optional) + * @param aPageDescriptor (optional) * Accepted for compatibility reasons, but is otherwise ignored. - * @param aDocument (deprecated, optional) + * @param aDocument (optional) * The content document we would like to view the source of. This * function will throw if aDocument is a CPOW. - * @param aLineNumber (deprecated, optional) + * @param aLineNumber (optional) * The line number to focus on once the source is loaded. * @param aCallBack * A function accepting two arguments: @@ -231,10 +229,6 @@ var gViewSourceUtils = { aLineNumber, aCallBack) { let data; if (typeof aArgsOrURL == "string") { - Deprecated.warning("The arguments you're passing to " + - "openInExternalEditor are using an out-of-date API.", - "https://developer.mozilla.org/en-US/Add-ons/" + - "Code_snippets/View_Source_for_XUL_Applications"); if (Components.utils.isCrossProcessWrapper(aDocument)) { throw new Error("View Source cannot accept a CPOW as a document."); } -- cgit v1.2.3