Bug 1518956 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Unfortunately, I don't think the asserts that landed in this bug are OK.  The idl says:

  boolean schemeIs(in string scheme);

and xpconnect will happily allow JS to pass null for a "string" argument, making it into a nullptr char* on the C++ side.  So there's nothing preventing null ending up in there, from the JS side.

A testcase that crashes with these changes is evaluating this in the browser console:

  Services.io.newURI("data:text/plain,aaa").schemeIs(null)

It might be OK to just have schemeIs return false when the string arg is null, though, instead of asserting that it's not null.
Unfortunately, I don't think the asserts that landed in this bug are OK.  The idl says:

```
  boolean schemeIs(in string scheme);
```

and xpconnect will happily allow JS to pass null for a "string" argument, making it into a nullptr char* on the C++ side.  So there's nothing preventing null ending up in there, from the JS side.

A testcase that crashes with these changes is evaluating this in the browser console:

```
  Services.io.newURI("data:text/plain,aaa").schemeIs(null)
```

It might be OK to just have schemeIs return false when the string arg is null, though, instead of asserting that it's not null.

Back to Bug 1518956 Comment 5