B2G SMS: ctypes undefined error in systemlib.js in xpcshell tests for SMS

RESOLVED FIXED in mozilla14

Status

()

Core
DOM: Device Interfaces
--
minor
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: vicamo, Assigned: vicamo)

Tracking

unspecified
mozilla14
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Attachement 604277 in bug 734299 breaks xpcshell tests with error "resource://gre/modules/systemlibs.js:101: ReferenceError: ctypes is not defined". In systemlibs.js line 20, the already existing libcutils returns a dummy on error catched, while libnetutils still try to create an working object for return at line 100.

This error is found within x86_x64 b2g build.
The xpcshell test can easily import resource://gre/modules/ctypes.jsm and pass that into the worker scope.
(Assignee)

Comment 2

5 years ago
Created attachment 605819 [details] [diff] [review]
import ctyps.jsm

verified with existing test scripts
Attachment #605819 - Flags: review?(philipp)
Comment on attachment 605819 [details] [diff] [review]
import ctyps.jsm

Hmm, does this even work? The worker only sees 'worker_ns' created in 'newWorker()', no? I was thinking of importing it directly into the worker namespace, like so:

  function newWorker(custom_ns) {
    let worker_ns = {
      ...
    };
    Cu.import("resource://gre/modules/ctypes.jsm", worker_ns);
    ...
    return worker_ns;
  }

I think that's more elegant, too...
Attachment #605819 - Flags: review?(philipp)
(Assignee)

Comment 4

5 years ago
(In reply to Philipp von Weitershausen [:philikon] from comment #3)
> Comment on attachment 605819 [details] [diff] [review]
> import ctyps.jsm
> 
> Hmm, does this even work? The worker only sees 'worker_ns' created in
> 'newWorker()', no?

Strange, but it does :)

> I was thinking of importing it directly into the worker
> namespace, like so:
> 
>   function newWorker(custom_ns) {
>     let worker_ns = {
>       ...
>     };
>     Cu.import("resource://gre/modules/ctypes.jsm", worker_ns);
>     ...
>     return worker_ns;
>   }
> 
> I think that's more elegant, too...

Perfect!
(Assignee)

Comment 5

5 years ago
Created attachment 606075 [details] [diff] [review]
import ctyps.jsm : V2
Attachment #605819 - Attachment is obsolete: true
Attachment #606075 - Flags: review?(philipp)
(Assignee)

Updated

5 years ago
Assignee: nobody → vyang
Attachment #606075 - Flags: review?(philipp) → review+
https://hg.mozilla.org/mozilla-central/rev/29e6ffe61193
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.