Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / unit / test_bogus_files.js
blob1e8b9f0f2a4a47a8ace495a3d5e858118c907068
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 function test_BrokenFile(path, shouldThrow, expectedName) {
6   var didThrow = false;
7   try {
8     ChromeUtils.import(path);
9   } catch (ex) {
10     var exceptionName = ex.name;
11     print("ex: " + ex + "; name = " + ex.name);
12     didThrow = true;
13   }
15   Assert.equal(didThrow, shouldThrow);
16   if (didThrow)
17     Assert.equal(exceptionName, expectedName);
20 function run_test() {
21   test_BrokenFile("resource://test/bogus_exports_type.jsm", true, "Error");
23   test_BrokenFile("resource://test/bogus_element_type.jsm", true, "Error");
25   test_BrokenFile("resource://test/non_existing.jsm",
26                   true,
27                   "NS_ERROR_FILE_NOT_FOUND");
29   test_BrokenFile("chrome://test/content/test.jsm",
30                   true,
31                   "NS_ERROR_FILE_NOT_FOUND");