Merge backout of changeset 870f451d8385 from bug 506116

This commit is contained in:
Gavin Sharp 2009-07-28 03:41:45 -04:00
Родитель 8c44609273 8fa47bdaa1
Коммит cb63d5e30f
2 изменённых файлов: 46 добавлений и 23 удалений

Просмотреть файл

@ -2660,8 +2660,9 @@ var browserDragAndDrop = {
var file = dt.mozGetDataAt("application/x-moz-file", 0); var file = dt.mozGetDataAt("application/x-moz-file", 0);
if (file) { if (file) {
var name = file instanceof Ci.nsIFile ? file.leafName : ""; var name = file instanceof Ci.nsIFile ? file.leafName : "";
var fileHandler = ContentAreaUtils.ioService var ioService = Cc["@mozilla.org/network/io-service;1"]
.getProtocolHandler("file") .getService(Ci.nsIIOService);
var fileHandler = ioService.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler); .QueryInterface(Ci.nsIFileProtocolHandler);
return [fileHandler.getURLSpecFromFile(file), name]; return [fileHandler.getURLSpecFromFile(file), name];
} }
@ -2888,7 +2889,9 @@ const DOMLinkHandler = {
break; break;
var targetDoc = link.ownerDocument; var targetDoc = link.ownerDocument;
var uri = makeURI(link.href, targetDoc.characterSet); var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var uri = ios.newURI(link.href, targetDoc.characterSet, null);
if (gBrowser.isFailedIcon(uri)) if (gBrowser.isFailedIcon(uri))
break; break;
@ -4419,7 +4422,10 @@ nsBrowserAccess.prototype =
if (aURI) { if (aURI) {
if (aOpener) { if (aOpener) {
location = aOpener.location; location = aOpener.location;
referrer = makeURI(location); referrer =
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(location, null, null);
} }
newWindow.QueryInterface(Ci.nsIInterfaceRequestor) newWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
@ -4436,7 +4442,10 @@ nsBrowserAccess.prototype =
newWindow = aOpener.top; newWindow = aOpener.top;
if (aURI) { if (aURI) {
location = aOpener.location; location = aOpener.location;
referrer = makeURI(location); referrer =
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(location, null, null);
newWindow.QueryInterface(Ci.nsIInterfaceRequestor) newWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(nsIWebNavigation) .getInterface(nsIWebNavigation)
@ -5406,7 +5415,17 @@ var OfflineApps = {
_getManifestURI: function(aWindow) { _getManifestURI: function(aWindow) {
if (!aWindow.document.documentElement) return null; if (!aWindow.document.documentElement) return null;
var attr = aWindow.document.documentElement.getAttribute("manifest"); var attr = aWindow.document.documentElement.getAttribute("manifest");
return attr ? aWindow.document.documentURIObject : null; if (!attr) return null;
try {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var contentURI = ios.newURI(aWindow.location.href, null, null);
return ios.newURI(attr, aWindow.document.characterSet, contentURI);
} catch (e) {
return null;
}
}, },
// A cache update isn't tied to a specific window. Try to find // A cache update isn't tied to a specific window. Try to find
@ -5604,7 +5623,10 @@ var OfflineApps = {
if (!manifest) if (!manifest)
return; return;
var manifestURI = makeURI(manifest, aDocument.characterSet, var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var manifestURI = ios.newURI(manifest, aDocument.characterSet,
aDocument.documentURIObject); aDocument.documentURIObject);
var updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"]. var updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"].
@ -5618,7 +5640,9 @@ var OfflineApps = {
{ {
if (aTopic == "dom-storage-warn-quota-exceeded") { if (aTopic == "dom-storage-warn-quota-exceeded") {
if (aSubject) { if (aSubject) {
var uri = aSubject.document.documentURIObject; var uri = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(aSubject.location.href, null, null);
if (OfflineApps._checkUsage(uri)) { if (OfflineApps._checkUsage(uri)) {
var browserWindow = var browserWindow =
@ -5679,7 +5703,9 @@ var MailIntegration = {
mailtoUrl += "&subject=" + encodeURIComponent(aSubject); mailtoUrl += "&subject=" + encodeURIComponent(aSubject);
} }
var uri = makeURI(mailtoUrl); var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI(mailtoUrl, null, null);
// now pass this uri to the operating system // now pass this uri to the operating system
this._launchExternalUrl(uri); this._launchExternalUrl(uri);

Просмотреть файл

@ -41,15 +41,6 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
var ContentAreaUtils = {
get ioService() {
delete this.ioService;
return this.ioService =
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
}
}
/** /**
* urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal * urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal
* and checkLoadURIStrWithPrincipal. * and checkLoadURIStrWithPrincipal.
@ -781,12 +772,16 @@ function makeWebBrowserPersist()
*/ */
function makeURI(aURL, aOriginCharset, aBaseURI) function makeURI(aURL, aOriginCharset, aBaseURI)
{ {
return ContentAreaUtils.ioService.newURI(aURL, aOriginCharset, aBaseURI); var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ioService.newURI(aURL, aOriginCharset, aBaseURI);
} }
function makeFileURI(aFile) function makeFileURI(aFile)
{ {
return ContentAreaUtils.ioService.newFileURI(aFile); var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ioService.newFileURI(aFile);
} }
function makeFilePicker() function makeFilePicker()
@ -1030,7 +1025,9 @@ function getCharsetforSave(aDocument)
*/ */
function openURL(aURL) function openURL(aURL)
{ {
var uri = makeURI(aURL, null, null); var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ios.newURI(aURL, null, null);
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"] var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
.getService(Components.interfaces.nsIExternalProtocolService); .getService(Components.interfaces.nsIExternalProtocolService);