Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Expose information about @resources in GM_info.

Fixes #1610
  • Loading branch information...
commit d4007d9e3582ba56f8d880d9891b03ee18aa25d3 1 parent 01cb1d4
@arantius arantius authored
View
9 modules/script.js
@@ -461,6 +461,13 @@ Script.prototype.info = function() {
for (var i = 0, m = null; m = this.matches[i]; i++) {
matches[matches.length] = m.pattern;
}
+ var resources = {};
+ for (var i = 0, r = null; r = this.resources[i]; i++) {
+ resources[r.name] = {
+ 'name': r.name,
+ 'mimetype': r.mimetype,
+ };
+ }
return {
'uuid': this.uuid,
'version': gGreasemonkeyVersion,
@@ -474,7 +481,7 @@ Script.prototype.info = function() {
'name': this.name,
'namespace': this.namespace,
// 'requires': ???,
- // 'resources': ???,
+ 'resources': resources,
'run-at': this.runAt,
'version': this.version,
},
View
9 modules/scriptDependency.js
@@ -52,6 +52,15 @@ function ScriptDependency_getFilename() {
return '' + (this._filename || this._dataURI || '');
});
+ScriptDependency.prototype.__defineGetter__('mimetype',
+function ScriptDependency_getMimetype() {
+ var mimetype = this._mimetype;
+ if (this._charset && this._charset.length > 0) {
+ mimetype += ';charset=' + this._charset;
+ }
+ return mimetype;
+});
+
ScriptDependency.prototype.__defineGetter__('name',
function ScriptDependency_getName() { return '' + this._name; });
View
7 modules/scriptResource.js
@@ -14,11 +14,6 @@ ScriptResource.prototype.__defineGetter__('dataContent',
function ScriptResource_getDataContent() {
var binaryContents = GM_util.getBinaryContents(this.file);
- var mimetype = this._mimetype;
- if (this._charset && this._charset.length > 0) {
- mimetype += ';charset=' + this._charset;
- }
-
- return 'data:' + mimetype
+ return 'data:' + this.mimetype
+ ';base64,' + encodeURIComponent(btoa(binaryContents));
});
Please sign in to comment.
Something went wrong with that request. Please try again.