Closed Bug 920586 Opened 11 years ago Closed 11 years ago

Allows chrome usages of TCPSocket

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file)

For the Fx OS Simulator addon, we are using TCPSocket as an xpcom:
  let TCPSocket = Cc["@mozilla.org/tcp-socket;1"]
                    .createInstance(Ci.nsIDOMTCPSocket);
  let socket = TCPSocket.open("127.0.0.1", 5037, {});

But the thing is that, in order to do that, we are toggling the dom.mozTCPSocket.enabled pref, that also enables it for content.

If I remember correctly nsIDOMGlobalPropertyInitializer behavior, given that we returns null in `init` method when the pref is false, we shouldn't need to disable open and listen methods as mozTCPSocket will be null or undefined in content.
Here is a patch to remove the two checks in open and listen, but I'm also fine keeping checks as soon as we can somehow toggle chrome usage without enabling content one.
Attachment #809950 - Flags: review?(bent.mozilla)
Blocks: 915261
>as soon as we can somehow toggle chrome usage without enabling content one.

Move to WebIDL?  ;)
(In reply to Boris Zbarsky [:bz] from comment #2)
> >as soon as we can somehow toggle chrome usage without enabling content one.
> 
> Move to WebIDL?  ;)

Yes, seriously!
Hum sure, WebIDL, but it sounds way more complex than removing 4 lines :p
It's not very clear what is the state of bug 885982. The patch is most likely bitrot, but is it really about only keeping test_tcpsocket_ipc.js in some way or another? (It looks like we should just be doing a mochitest-plain, don't we? Mochitest-plain would run in a child on b2g.)

I can surely give a hand about testing, as I have some background on mochitests and b2g,
but what concerns me is that I'd need to uplift to aurora... I'm not sure the move to WebIDL is a good candidate for uplift.
Yes, if you need to uplift then "use WebIDL" is not viable.
Comment on attachment 809950 [details] [diff] [review]
Allows chrome usages

bent looks busy, trying another potential review for this file.
Attachment #809950 - Flags: review?(bent.mozilla) → review?(josh)
Attachment #809950 - Flags: review?(josh) → review+
Keywords: checkin-needed
Assignee: nobody → poirot.alex
https://hg.mozilla.org/mozilla-central/rev/7dbd88b7f43b
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: