Bug 795161 - Make systemlibs.js importable. r=philikon
authorHubert Figuière <hfiguiere@mozilla.com>
Thu, 27 Sep 2012 16:43:54 -0700
changeset 108374 4cf6ad64c3f9916152de2955ba009e3cee1ece33
parent 108373 c637ee14bccdc07c3687eab43a9267f6d642ab8e
child 108375 22df14239cfbeecf7abb721810c691f7357fe8af
push id15498
push userhfiguiere@mozilla.com
push dateFri, 28 Sep 2012 04:11:20 +0000
treeherdermozilla-inbound@22df14239cfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilikon
bugs795161
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 795161 - Make systemlibs.js importable. r=philikon
dom/system/gonk/systemlibs.js
--- a/dom/system/gonk/systemlibs.js
+++ b/dom/system/gonk/systemlibs.js
@@ -8,16 +8,23 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
+let EXPORTED_SYMBOLS;
+if (!this.ctypes) {
+  // We're likely being loaded as a JSM.
+  EXPORTED_SYMBOLS = [ "libcutils", "libnetutils", "netHelpers" ];
+  Components.utils.import("resource://gre/modules/ctypes.jsm");
+}
+
 const SYSTEM_PROPERTY_KEY_MAX = 32;
 const SYSTEM_PROPERTY_VALUE_MAX = 92;
 
 // We leave this as 'undefined' instead of setting it to 'false'. That
 // way a file that includes us can have it defined already without us
 // overriding the value here.
 let DEBUG;