michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // Bug 442086 - XPConnect creates doubles without checking for michael@0: // the INT_FITS_IN_JSVAL case michael@0: michael@0: var types = [ michael@0: 'PRUint8', michael@0: 'PRUint16', michael@0: 'PRUint32', michael@0: 'PRUint64', michael@0: 'PRInt16', michael@0: 'PRInt32', michael@0: 'PRInt64', michael@0: 'float', michael@0: 'double' michael@0: ]; michael@0: michael@0: function run_test() michael@0: { michael@0: var i; michael@0: for (i = 0; i < types.length; i++) { michael@0: var name = types[i]; michael@0: var cls = Components.classes["@mozilla.org/supports-" + name + ";1"]; michael@0: var ifname = ("nsISupports" + name.charAt(0).toUpperCase() + michael@0: name.substring(1)); michael@0: var f = cls.createInstance(Components.interfaces[ifname]); michael@0: michael@0: f.data = 0; michael@0: switch (f.data) { michael@0: case 0: /*ok*/ break; michael@0: default: do_throw("FAILED - bug 442086 (type=" + name + ")"); michael@0: } michael@0: } michael@0: }