1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
6 let sandbox = Cu.Sandbox(this);
7 let callbackWrapped = Cu.evalInSandbox("(function wrapped() {})", sandbox);
11 [{ notify: callback }, "callback[test_function_names.js]:JS"],
12 [{ notify: { notify: callback } }, "callback[test_function_names.js]:JS"],
13 [callback, "callback[test_function_names.js]:JS"],
14 [function() {}, "run_test/functions<[test_function_names.js]:JS"],
15 [function foobar() {}, "foobar[test_function_names.js]:JS"],
16 [function Δ() {}, "Δ[test_function_names.js]:JS"],
17 [{ notify1: callback, notify2: callback }, "nonfunction:JS"],
18 [{ notify: 10 }, "nonfunction:JS"],
19 [{}, "nonfunction:JS"],
20 [{ notify: callbackWrapped }, "wrapped[test_function_names.js]:JS"],
23 // Use the observer service so we can get double-wrapped functions.
24 var obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
26 function observer(subject, topic, data)
28 let named = subject.QueryInterface(Ci.nsINamed);
29 Assert.equal(named.name, data);
30 dump(`name: ${named.name}\n`);
32 obs.addObserver(observer, "test-obs-fun", false);
34 for (let [f, requiredName] of functions) {
35 obs.notifyObservers(f, "test-obs-fun", requiredName);