Closed Bug 1545841 Opened 8 months ago Closed 7 months ago

Emit console warning for deprecated proxy APIs

Categories

(WebExtensions :: Frontend, enhancement, P1)

enhancement

Tracking

(firefox68 verified)

VERIFIED FIXED
mozilla68
Tracking Status
firefox68 --- verified

People

(Reporter: mconca, Assigned: robwu)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

Beginning in Firefox 68, the browser console should emit a warning that the following APIs will be removed in Firefox 71:

  • proxy.register
  • proxy.unregister
  • proxy.onProxyError
Assignee: nobody → rob
Priority: -- → P1

I've submitted a patch, and also added a deprecation notice for proxy.registerProxyScript. This method is not documented, but was the original name of proxy.register (Firefox 55, bug 1295807) until its rename in the next version (Firefox 56, bug 1371879).

I wanted to include a link to a migration guide, but since there is none, I just logged a message to state their removal.
If a migration guide becomes available, I may update the deprecation message.

The current MDN doesn't mention anything about the deprecation. The following articles (as well as the browser-compat-data associated with them) should be updated, to feature a prominent deprecation notice:

Keywords: dev-doc-needed
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/23b9b8480e0a
Add deprecation message to several proxy APIs r=mixedpuppy
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Attached image proxyConsoleWarning.png

Verified in Win7x64, Mac OS X 10.14.1 using FF68.0a1 (20190513215004).

The messages for the 3 deprecated APIs are displayed as errors in the browser console, from the title I understand that we will be showing warnings. Is this ok? Do we want to this this? (please view the attached screenshot)

Flags: needinfo?(rob)

The most important part is that a message is logged to the console.
I think that styling it as an error is not that big of an issue.

When it is an error, there is a stack trace associated with it, that may help with identifying the caller of the deprecated method. For example:

proxy.register has been deprecated and will be removed in Firefox 71.
    makeError resource://gre/modules/Schemas.jsm:459
    logDeprecation resource://gre/modules/Schemas.jsm:1109
    checkDeprecated resource://gre/modules/Schemas.jsm:1121
    stub resource://gre/modules/Schemas.jsm:2333
    a moz-extension://e0a49782-8f4a-406a-bceb-f8c6eddbf4f0/background.js:2
    <anonymous> moz-extension://e0a49782-8f4a-406a-bceb-f8c6eddbf4f0/background.js:4

background.js that I used for testing:

function a(){
    browser.proxy.register()
}
a();
Flags: needinfo?(rob)

Thanks for the fast response Rob! I agree with your comment.
Marking this bug as verified fixed.

Status: RESOLVED → VERIFIED

A deprecation notice has already been added to both proxy.register and proxy.unregister. Directly below the generic deprecation notice, I added an image of the console error to: proxy.register and proxy.unregister with the following text:

This method has been deprecated in Firefox 68 and will be removed from Firefox 71. In Firefox 68 or later, calling this method logs an error message to the console

Flags: needinfo?(rob)

Since Firefox 68 has been released this week, could you edit and change "will be deprecated" to "has been deprecated"?

The browser-compat-table entries also need to be updated, please send a PR to update https://github.com/mdn/browser-compat-data/blob/323ac51f4b005fa39ce6fc6fe9ef6ca7434a4455/webextensions/api/proxy.json

And do you know who is responsible for / is able to update the example @ https://github.com/mdn/webextensions-examples/issues/410 ?

Flags: needinfo?(rob) → needinfo?(ismith)

(In reply to Rob Wu [:robwu] from comment #9)

Since Firefox 68 has been released this week, could you edit and change "will be deprecated" to "has been deprecated"?

Yeah, sorry, I missed changing the warning on the proxy page but the method pages already say "has been deprecated"

The browser-compat-table entries also need to be updated, please send a PR to update https://github.com/mdn/browser-compat-data/blob/323ac51f4b005fa39ce6fc6fe9ef6ca7434a4455/webextensions/api/proxy.json

The PR for BCD is: PR #4496

And do you know who is responsible for / is able to update the example @ https://github.com/mdn/webextensions-examples/issues/410 ?

That would be me as well. I have to update the code and create a PR. Thank you for the reminder. Can I request you as a reviewer?

Flags: needinfo?(ismith)

(In reply to Irene Smith from comment #10)

(In reply to Rob Wu [:robwu] from comment #9)

And do you know who is responsible for / is able to update the example @ https://github.com/mdn/webextensions-examples/issues/410 ?

That would be me as well. I have to update the code and create a PR. Thank you for the reminder. Can I request you as a reviewer?

Sure!

You need to log in before you can comment on or make changes to this bug.