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: "use strict"; michael@0: michael@0: module.metadata = { michael@0: "stability": "experimental" michael@0: }; michael@0: michael@0: const { Cc, Ci, Cr } = require("chrome"); michael@0: const IOService = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: const { isValidURI } = require("../url"); michael@0: const { method } = require("../../method/core"); michael@0: michael@0: function newURI (uri) { michael@0: if (!isValidURI(uri)) michael@0: throw new Error("malformed URI: " + uri); michael@0: return IOService.newURI(uri, null, null); michael@0: } michael@0: exports.newURI = newURI; michael@0: michael@0: let getURL = method('sdk/url:getURL'); michael@0: getURL.define(String, function (url) url); michael@0: getURL.define(function (object) { michael@0: return null; michael@0: }); michael@0: exports.getURL = getURL;