Closed Bug 1206746 Opened 4 years ago Closed 4 years ago

Module `./adb-socket` is not found, can't connect to USB device in Nightly 43.0a1 (2015-09-21)


(DevTools :: WebIDE, defect)

Not set


(Not tracked)



(Reporter: kdavis, Assigned: ochameau)




(1 file)

44 bytes, text/x-github-pull-request
: review+
Details | Review
I am on OS X 10.10.5 and have a USB connected Flame-KK device that
shows up using

adb devices

I open the WebIDE in  Nightly 43.0a1 (2015-09-21) and the device
is not listed.

I subsequently close Nightly 43.0a1 (2015-09-21) and start an old
version of Firefox 37.0.2 and attempt the same, to connect to the
device using WebIDE. This works.

Using Nightly 43.0a1 (2015-09-21) and attempting to connect to the
device using WebIDE the browser console contains the stack trace....

Module `./adb-socket` is not found at resource:// @resource://
I've heard that main culprit is TCPSocket changes to WebIDL (bug 885982).
:gerard-majax already debugged this exception and the SDK loader is hidding the real exception here :/

This error is related to bug 885982.
  let scope = Cu.Sandbox(Services.scriptSecurityManager.getSystemPrincipal());
  scope.DOMError = Cu.import('resource://gre/modules/Services.jsm').DOMError;
  Services.scriptloader.loadSubScript("resource://gre/components/TCPSocket.js", scope);
  scope.TCPSocket.prototype.initWindowless = function () true;
  return new scope.TCPSocket();

We were fetching a TCPSocket instance from a Sandbox,
but it looks like, now, with the WebIDL, we have to set the related pref AND have a document instance.
That is quite unfortunate, especially the pref.

Josh, Do you think we can easily fetch a TCPSocket instance from chrome code (without setting the pref)?
Flags: needinfo?(josh)
Not as the code exists today. It may be possible to change the WebIDL files to use `Func=ShouldTCPSocketExist` instead of `Pref=` and `CheckAll=`, where ShouldTCPSocketExist would check the following:
- is the global using a system principal (something like and calling nsContentUtils::IsSystemPrincipal)
- is the preference enabled
- does CheckAnyPermissions return true (

Andrew, you made a comment about socket.jsm in but I don't see that file anywhere.
Flags: needinfo?(josh) → needinfo?(bugmail)
Duplicate of this bug: 1207032
Summary: Unable to connect to USB connected Flame-KK using WedIDE in Nightly 43.0a1 (2015-09-21) on OS X 10.10.5 → Module `./adb-socket` is not found, can't connect to USB device in Nightly 43.0a1 (2015-09-21)
(In reply to Alexandre Poirot [:ochameau] from comment #2)
> That is quite unfortunate, especially the pref.

Note that bug 1079648 covers flipping the pref on Firefox and includes some minimal discussion of removing the preference in general.
Depends on: 1207090
Attached file Pull request 18
Here is a patch to use WebIDL's TCPSocket.
It requires a firefox build with bug 1207090's patch applied.
It also cleans up adb.js from duplicated code with adb-client.js.
(I made two distinct commits to help the review)
Assignee: nobody → poirot.alex
I'm now waiting for bug 1207090's review before proceeding.
Comment on attachment 8664769 [details] [review]
Pull request 18

I just pushed a new revision, with a bug fixed on release (was returning new TCPSocket() result instead of in release-TCPSocket.jsm codepath!)

Platform patch re-landed, hopefully it will stick this time.
Asking review early in order to help releasing the addon ASAP.
Attachment #8664769 - Flags: review?(jryans)
Comment on attachment 8664769 [details] [review]
Pull request 18

Looks good to me! I'll test and release once the `TCPSocket` change lands in Firefox.
Attachment #8664769 - Flags: review?(jryans) → review+

Preparing a new add-on release now.
Closed: 4 years ago
Resolution: --- → FIXED
ADB Helper 0.8.1 submitted to AMO, waiting on approval.
ADB Helper 0.8.1 has been released.  It may take a few hours for the update to be available due to CDN caching.
As a side note, only 44 will work for the moment.  43 still needs bug 1207090 to be uplifted.
Depends on: 1210824
Depends on: 1214761
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.