Closed Bug 1524450 Opened 6 years ago Closed 6 years ago

External Protocol Service cannot be unregistered for tests

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 67.0

People

(Reporter: darktrojan, Unassigned)

References

Details

(Keywords: regression, Whiteboard: [thunderbird-disabled-test])

Attachments

(1 file)

In shared-modules/test-content-tab-helpers.js, we mock the external protocol service so we can test clicking on links. This is broken:

var contract = "@mozilla.org/uriloader/external-protocol-service;1";
var cid = Components.manager.contractIDToCID(contract);
var classObj = Components.manager.getClassObject(cid, Ci.nsIFactory);
Components.manager.unregisterFactory(cid, classObj);

[Exception... "Component returned failure code: 0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED) [nsIComponentRegistrar.unregisterFactory]"  nsresult: "0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED)"  location: "JS frame :: debugger eval code :: <TOP_LEVEL> :: line 1"  data: no]

I'm disabling a test in newmailaccount/test-newmailaccount.js. There's one in cloudfile/test-cloudfile-manager.js too, which is already disabled for bug 1522778.

Pushed by geoff@darktrojan.net: https://hg.mozilla.org/comm-central/rev/b6cc6a64d219 Disable tests that require mocking External Protocol Service; rs=bustage-fix

Do we know what regressed this?

Keywords: regression

Hard to tell after four days of bustage.

I clearly forgot to mention this is also the case in Firefox but they obviously don't try to do it or there'd be broken tests.

Geoff, can you give some STR for FF and then NI Alice (alice0775@gmail.com) to kindly find the regression for us.

Flags: needinfo?(alice0775)

Run the code from comment 0 in the developer tools.

Alice, can you please find regression with the code in comment #0. Thanks in advance.

Open Browser Console
Paste the following code and press ENTER key

var contract = "@mozilla.org/uriloader/external-protocol-service;1";
var cid = Components.manager.contractIDToCID(contract);
var classObj = Components.manager.getClassObject(cid, Ci.nsIFactory);
Components.manager.unregisterFactory(cid, classObj);

No error on Firefox65.
Error on Nightly67.0a1.

Regression window:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=91f5131e326ad99acb9a44567c9c08d3d1f8b06b&tochange=7ea334118c82e3609be2a1cfa3c5b867017c4937

Flags: needinfo?(alice0775)

Kris, this is not intentional, is it? What can be done to restore this function?

Blocks: 1478124
Component: General → XPCOM
Flags: needinfo?(kmaglione+bmo)
Product: Thunderbird → Core
Version: unspecified → Trunk

It is intentional, yes. Static components cannot be unregistered. You can override them by registering a new component with the same contract ID, though.

Flags: needinfo?(kmaglione+bmo)

Thanks, Kris. Moving this back to the TB queue.

Component: XPCOM → General
Product: Core → Thunderbird

Should I be able to unregister the override? unregisterFactory doesn't complain, but if I then try to get the original service (e.g. in the next test) NS_ERROR_XPC_GS_RETURNED_FAILURE is thrown.

Flags: needinfo?(kmaglione+bmo)
Attached patch 1524450-enable-tests-1.diff (deleted) — Splinter Review

Bug 1528437 fixed this.

Flags: needinfo?(kmaglione+bmo)

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/4ba6ad8570e5
Backed out changeset b6cc6a64d219 to re-enable tests fixed by bug 1528437. a=backout

Status: NEW → RESOLVED
Closed: 6 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 67.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: