Gabriel Ivăncescu (@insn) commented about dlls/mshtml/tests/documentmode.js:
ok(x.setterVal === 9, "x.setterVal after setting bar = " + x.setterVal);
});
+sync_test("MutationObserver_exceptions", function() {
- if (document.documentMode < 11) {
return;
- }
- var e = null;
- try {
window.MutationObserver();
- } catch(ex) {
e = ex;
- }
- ok(e != null, "MutationObserver without new should fail");
- ok(e.number == 0xffff - 0x80000000, "MutationObserver without new threw exception " + e.number);
You can place the `ok` tests in the catch() block and add a `ok(false, "Expected exception without new on no arguments")` at the end of the try block for example, then you won't need the `e` variable either (just look at similar tests), neither the `null` check nor its initialization. Same for other tests below.
Also you are **not** testing it what happens if you don't use "new" but with a proper argument (function)? I believe it should work, but testing will reveal it.
BTW, you are still not testing what happens if you call it with more than one arg. I know it probably doesn't throw exception, hence why I suggested renaming this test and adding it, showing it succeeds and they are ignored.