-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
if user Script content include "@require" , UserScriptLoader.uc.js 0.1.8.1 get an error.
this function maybe can fix like this?
USL.getContents = function(aURL, aCallback){
try {
urlSecurityCheck(aURL, gBrowser.contentPrincipal, Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
} catch(ex) {
return;
}
var uri = Services.io.newURI(aURL, null, null);
if (uri.scheme != 'http' && uri.scheme != 'https')
return USL.error('getContents is "http" or "https" only');
let aFile = USL.REQUIRES_FOLDER.clone();
aFile.QueryInterface(Ci.nsILocalFile);
aFile.appendRelativePath(encodeURIComponent(aURL));
var wbp = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);
wbp.persistFlags &= ~Components.interfaces.nsIWebBrowserPersist.PERSIST_FLAGS_NO_CONVERSION;
if (aCallback) {
wbp.progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP){
let channel = aRequest.QueryInterface(Ci.nsIHttpChannel);
let bytes = USL.loadBinary(aFile);
aCallback(bytes, channel.contentType);
return;
}
},
onLocationChange: function(aProgress, aRequest, aURI){},
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {},
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {},
onSecurityChange: function(aWebProgress, aRequest, aState) {},
onLinkIconAvailable: function(aIconURL) {},
}
}
wbp.saveURI(uri, null, null, null, null, aFile, null);
USL.debug("getContents: " + aURL);
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels