Closed Bug 735589 Opened 12 years ago Closed 12 years ago

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

Categories

(Core :: DOM: Device Interfaces, defect)

x86_64
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: vicamo, Assigned: vicamo)

References

Details

Attachments

(1 file, 1 obsolete file)

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.
Attached patch import ctyps.jsm (obsolete) — Splinter Review
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)
(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!
Attachment #605819 - Attachment is obsolete: true
Attachment #606075 - Flags: review?(philipp)
Assignee: nobody → vyang
Attachment #606075 - Flags: review?(philipp) → review+
https://hg.mozilla.org/mozilla-central/rev/29e6ffe61193
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: