[seed] Stop mangling this object when importer includes JS files
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] Stop mangling this object when importer includes JS files
- Date: Sat, 9 May 2009 22:26:20 -0400 (EDT)
commit 7f49aa1d1cb32273f2e0a6c4287f4a033b000ee3
Author: Robert Carr <racarr svn gnome org>
Date: Sat May 9 22:26:10 2009 -0400
Stop mangling this object when importer includes JS files
---
libseed/seed-importer.c | 6 ++--
modules/dbus/Makefile.am | 2 +-
modules/dbus/dbus.js | 47 +++++++++++++++++++++++++++++++--------------
modules/dbus/lang.js | 33 +++++++++----------------------
4 files changed, 46 insertions(+), 42 deletions(-)
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index e9c84d8..e1b64c0 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -618,7 +618,7 @@ seed_importer_handle_file (JSContextRef ctx,
g_hash_table_insert (file_imports, canonical, global);
g_free (file_path);
- JSEvaluateScript (nctx, file_contents, c_global, file_name, 0, exception);
+ JSEvaluateScript (nctx, file_contents, NULL, file_name, 0, exception);
// Does leak...but it's a debug statement.
SEED_NOTE (IMPORTER, "Evaluated file, exception: %s",
@@ -639,7 +639,7 @@ seed_importer_search (JSContextRef ctx,
JSValueRef *exception)
{
GSList *path, *walk;
- gchar *prop_as_lib = g_strconcat ("lib", prop, NULL);
+ gchar *prop_as_lib = g_strconcat ("lib", prop, ".", G_MODULE_SUFFIX, NULL);
path = seed_importer_get_search_path (ctx, exception);
@@ -681,7 +681,7 @@ seed_importer_search (JSContextRef ctx,
return ret;
}
- else if (g_str_has_prefix (mentry, prop_as_lib) && g_str_has_suffix (entry, G_MODULE_SUFFIX))
+ else if (!strcmp(entry, prop_as_lib))
{
JSObjectRef ret;
diff --git a/modules/dbus/Makefile.am b/modules/dbus/Makefile.am
index 7dcffa6..46df048 100644
--- a/modules/dbus/Makefile.am
+++ b/modules/dbus/Makefile.am
@@ -1,6 +1,6 @@
if BUILD_DBUS_MODULE
-moduledir = ${seeddir}/share/seed
+moduledir = $(datadir)/seed
module_DATA = dbus.js lang.js
seedlibdir = ${exec_prefix}/lib/seed
diff --git a/modules/dbus/dbus.js b/modules/dbus/dbus.js
index 94c2d01..0bce51a 100644
--- a/modules/dbus/dbus.js
+++ b/modules/dbus/dbus.js
@@ -1,6 +1,6 @@
// Copyright 2008 litl, LLC. All Rights Reserved.
-const Lang = imports.lang;
+Lang = imports.lang;
//const StringUtil = imports.stringUtil;
//const ArrayUtil = imports.arrayUtil;
@@ -13,7 +13,8 @@ const NO_START_IF_NOT_FOUND = false;
const START_IF_NOT_FOUND = true;
// Merge stuff defined in native code
-Lang.copyProperties(imports.dbusnative, this);
+dbusnative = imports.dbusnative;
+Lang.copyProperties(dbusnative, this);
var Introspectable = {
name: 'org.freedesktop.DBus.Introspectable',
@@ -282,7 +283,7 @@ function proxifyPrototype(proto, iface) {
// convert any object to a dbus proxy ... assumes its prototype is
// also proxified
-this._busProto.proxifyObject = function(obj, busName, path) {
+this.system.proxifyObject = this.session.proxifyObject = function(obj, busName, path) {
if (!busName) {
throw new Error('missing bus name proxifying object');
}
@@ -312,7 +313,7 @@ var _addExports = function(node, path, object) {
_addExports(node[head], tail, object);
}
};
-
+// Fiiix
// remove any implementation from exports at the given path.
var _removeExportsPath = function(node, path) {
if (path == '') {
@@ -324,13 +325,14 @@ var _removeExportsPath = function(node, path) {
// recursively delete next component
_removeExportsPath(node[head], tail);
// are we empty now? if so, clean us up.
- if ([x for (x in node[head])].length == 0) {
- delete node[head];
- }
+ // If we had destructuring assignment, this would be cool
+// if ([x for (x in node[head])].length == 0) {
+// delete node[head];
+ // }
}
};
-
+this._busProto = this.session.__proto__
// export the object at the specified object path
this._busProto.exportObject = function(path, object) {
if (path.slice(0,1) != '/')
@@ -409,21 +411,36 @@ function _eatSCT(acc, s) {
}
// parse signature string, generating a list of "single complete types"
-function _parseDBusSigs(sig) {
+//function _parseDBusSigs(sig) {
+ // while (sig.length > 0) {
+ // var one = [];
+ // sig = _eatSCT(one, sig);
+ // yield one.join('');
+// }
+//}
+
+function _parseDBusSigs(sig){
+ var sigs = [];
while (sig.length > 0) {
- var one = [];
- sig = _eatSCT(one, sig);
- yield one.join('');
+ sig = _eatSCT(sigs, sig);
}
+ return sigs.join('');
+}
+
+function getIfaces(ifaces) {
+ var a = new Array();
+ for (i in ifaces)
+ a.push(i);
+ return a;
}
// given a "this" with _dbusInterfaces, returns DBus Introspection
// format XML giving interfaces and methods implemented.
-function _getInterfaceXML() {
+/*function _getInterfaceXML() {
var result = '';
// iterate through defined interfaces
var ifaces = ('_dbusInterfaces' in this) ? this._dbusInterfaces : {};
- ifaces = [i for each (i in ifaces)]; // convert to array
+ ifaces = getIfaces(ifaces);
// add introspectable and properties
ifaces.push(Introspectable);
ifaces.push(Properties);
@@ -471,7 +488,7 @@ function _getInterfaceXML() {
result += ' </interface>\n';
}
return result;
-}
+}*/
// Verifies that a given object conforms to a given interface,
// and stores meta-info from the interface in the object as
diff --git a/modules/dbus/lang.js b/modules/dbus/lang.js
index baa00fc..7e8ceab 100644
--- a/modules/dbus/lang.js
+++ b/modules/dbus/lang.js
@@ -21,38 +21,25 @@
// Utilities that are "meta-language" things like manipulating object props
function countProperties(obj) {
- let count = 0;
- for (let property in obj) {
+ var count = 0;
+ for (var property in obj) {
count += 1;
}
return count;
}
function _copyProperty(source, dest, property) {
- let getterFunc = source.__lookupGetter__(property);
- let setterFunc = source.__lookupSetter__(property);
-
- if (getterFunc) {
- dest.__defineGetter__(property, getterFunc);
- }
-
- if (setterFunc) {
- dest.__defineSetter__(property, setterFunc);
- }
-
- if (!setterFunc && !getterFunc) {
- dest[property] = source[property];
- }
+ dest[property] = source[property];
}
function copyProperties(source, dest) {
- for (let property in source) {
+ for (var property in source) {
_copyProperty(source, dest, property);
}
}
function copyPublicProperties(source, dest) {
- for (let property in source) {
+ for (var property in source) {
if (typeof(property) == 'string' &&
property.substring(0, 1) == '_') {
continue;
@@ -63,7 +50,7 @@ function copyPublicProperties(source, dest) {
}
function copyPropertiesNoOverwrite(source, dest) {
- for (let property in source) {
+ for (var property in source) {
if (!(property in dest)) {
_copyProperty(source, dest, property);
}
@@ -71,7 +58,7 @@ function copyPropertiesNoOverwrite(source, dest) {
}
function removeNullProperties(obj) {
- for (let property in obj) {
+ for (var property in obj) {
if (obj[property] == null)
delete obj[property];
else if (typeof(obj[property]) == 'object')
@@ -89,8 +76,8 @@ function removeNullProperties(obj) {
* @type: function
*/
function bind(obj, callback) {
- let me = obj;
- let bindArguments = Array.prototype.slice.call(arguments, 2);
+ var me = obj;
+ var bindArguments = Array.prototype.slice.call(arguments, 2);
if (typeof(obj) != 'object') {
throw new Error(
@@ -105,7 +92,7 @@ function bind(obj, callback) {
}
return function() {
- let args = Array.prototype.slice.call(arguments);
+ var args = Array.prototype.slice.call(arguments);
args = args.concat(bindArguments);
return callback.apply(me, args);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]