Enumerating properties and retrieving values (All methods have failed)

Given some javascript like the following:

var g_number = 2;

function test()
    var str = "test";

I would like to be able to enumerate all the properties (e.g.
'g_number' and 'str') and get their names and values. I've tried
several different methods for doing so. So far, I've had the most
success using JS_GetPropertyDescArray. However, I haven't been able to
get the property values or any information about global properties.
Here's some simple test code:

JSPropertyDescArray pda;

JS_GetPropertyDescArray(pContext, pObject, &pda);

for(int j = 0; j < pda.length; j++)
     JSPropertyDesc desc = pda.array[j];

     std::string strPropertyName =

     JSString* pString = JS_ValueToString(pContext, desc.value);

     std::string strValue = "";

         strValue = JS_GetStringBytes( pString );

'strValue' comes back as 'undefined'. I've also tried calling
JS_GetProperty after retrieving the name, but without success.

Any ideas? One piece of information which might be useful: I'm using
JS_CompileScript to generate a JSScript object and then I'm iterating
through the atomMap in the script object.


5/29/2008 3:27:19 PM
netscape.mozilla.jseng 1530 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 52


Similar Artilces:

How to enumerate all values in multi-value property?
Hi experts, I'm not much of a devoloper (as you can propably tell ;-)), but I need to make a slight modification for HMC 4.0's MPSSampleWebUI. I need to be able to enumerate all values of multi-value property. Enumeration of one property value works fine, for example using following:  <CLIP> GetPropertiesRequest getPropertiesRequest = new GetPropertiesRequest();            getPropertiesRequest.Data = new GetPropertiesRequestData();            getProperties...

The server method failed and object doesn't support this property or method
I create a basic Atlas page which includes a script manager, 2 javascript functions and a couple of controls. I also create a webservices to return a dataset for Atlas page. It works well when I compile the whole website in my local machine. But when I copy evrything to the live site, it gives me error message like:The server method failed and javascript error message like:object doesn't support this property or method . It doesn't make sense to me. Please help!!! And the strange thing now is it works in https:// site on any machine. But it doesn't work on some computers o...

Retrieving RTTI property Value
XE6 I am new to this stuff; The code is huge, I will just put some details here asking for help: I have a base class: TEntity That I use to inherit to other classes, for example TEntityProduct Most of the time I only use the base class as reference. But know I need a property that is on the inherited class and I cannot just move it to the base class. In my base class i have created this procedure: {code} procedure TNaharEntity.AttachOwner(AOwner: TNaharEntity); var PropInfo: PPropInfo; begin PropInfo := GetPropInfo(AOwner, 'owner'); if Assigned(P...

[transmission] failed to retrieve property
Hi all > :~> transmission -m > Gtk-Message: (for origin information, set GTK_DEBUG): failed to > retrieve property `GtkTreeView::odd-row-color' of type `GdkColor' from > rc file value "((GString*) 0x844a240)" of type `GString' I have this problemn long time... but I think that is from my many moves to gnome 2.24 and back... but now i have clear install of opensuse 11.0 with updated packages from default update repository... But still have same problem... in some time of working it can go with bug error... I know that default p2p is monso...

Can the value of a CSS property depend on value of ANOTHER property?
One CSS selector has width: auto; .  I would like to set the value of the width property of another CSS selector to the value assigned to the width property of the first selector.  The browser would first determine the value for width of the first selector, and then it would set the width property of the second selector to that value.  Is that possible?  Is it possible to assign the value of a property based on the value of a different property?  Here is an example: .firstSelector { position: relative; height: 95%; ...

Method failed return value in setchanges ?
Hi, What is the reason for return value -1 (method failed) in setchanges function. In the button event script I declared the following line of codes The getchanges function is returning a value 1 blob lblob uo_test luo luo = create uo_test dw_1.getchanges(lblob) luo.of_update(lblob) In the user object uo_test I declared a function of_update (ref blob ablob as parameter) with the following lines of code // ids_data is a instance varibale of datastore ids_data.setchanges(ablob) but above line is always returning the value -1. Please any one can help me. TI...

retrieving values from list box then use this values to retrieve data from db to gridview
 help.. can anyone give me some idea or examples regarding this one... the select formula should be something like this.. but not totally like this..Dim selectinfo = (from a in db.PRs _where a.PRID = item[1] and a.PRID = item[2] and a.PRID = item[3] _select a) those item[1], item[2]....etc are the values inside the listbox...  how will i apply that into the select command... using loop...thank you in advance... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) string selectedItems = "";for (int vLoop = 0; vLoop < lstIte...

FileUpload control question: uploader.PostedFile.Method/Property vs uploader.Method/Property
I'm trying to use the FileUpload control in asp.net but I'm confused about the uploader's methods and its uploader.PostedFile methods / properties.uploader.SaveAs() vs uploader.PostedFile.SaveAs() ?uploader.FileName vs uploader.PostedFile.FileName ?uploader.FileContent vs uploader.PostedFile.ContentType ?uploader.FileByte vs uploader.PostedFile.ContentLength?So PostedFile refers to the object that's already been uploaded? Does that mean if I were to restrict the extention/size of an uploaded file, I actually do it after the file's been uploaded ? Is there a way to  n...

Retrieve value from "out" parameter from a method
I am using The Data Access Application block in an N-Layer scenario. In one of my Public Methods am returning a collection, but I am also passing back the Total Number of pages via the "out" parameter.I am having trouble getting the value of the "out" paramater which I specify in a method for the Data Access Layer and Business Logic Layer......solved this. I had to make sure that the out parameter was initialized before being used (even though it was only retrieving)...

Retrieving Server Properties values from PB Script
Is it possible to retrieve the "properties values" (those set on the ALL PROPERTIES tab in Jaguar Manager for the server) from within a PowerBuilder Script? Jaguar Manager allows you to add, modify, and delete those properties. But from PB, can you access those values at runtime? My hope is to set the dbparm, dbms, etc values in Jaguar Manager's All Properties tab and then retrieve them at runtime in order to allow for flexable, runtime, database connecting. To get the string value stored in property "org.myorg.mykeyword" into local string "the...

Enumerating standard class properties & methods
The objects Date, String, Number, etc are not enumerable within script. Not that that's a newsflash :) but I'm wondering if enumeration could be included in/has been considered for future releases. AFAIK there's little overhead. Thanks, Sterling Sterling Bates wrote: > The objects Date, String, Number, etc are not enumerable within script. Not > that that's a newsflash :) but I'm wondering if enumeration could be > included in/has been considered for future releases. ECMAScript edition 3 in section 15 where the native ECMAScript obje...

Retrieve changed property values in user control
I have read similar posts/articles to this effect, but i can't seem to apply it to my situation:I have a custom date picker that consists of 3 drop downs (day month year) and a button (Go)the control as a private property of datePicked and a public getter DatePickedthe Go button has an event that sets the value of datePicked to whatever is currently selectedif i Response.Write(datePicked) within the user control's Go_click event it outputs the correct date.when using the control on a page, the value of DatePicked is always read as 01/01/0001 00:00 even after the Go_click event.I'm assuming h...

C# Class, Method, Property.. but how do I get value?
 I have worked to get this far in my C# class. I am new to C# and true OO programming. I am not sure if I am using my variables correctly. The SQL querry, and connection work fine (so I will just comment them), because in debug mode I see the name of the correct store returned. Only problem is I am having a very hard time consuming _CoDiv or CoDiv on the calling .aspx page. What am I doing wrong?? public class PopulateStoreConfigScreen{    // use this line below if I need to throw an exception    //throw new Exception("The method or operation...

HtmlHelper is retrieving value from properties of ViewData. Bug??
Controller: public class HomeController : Controller{    public ActionResult Index()    {        ViewData["1"] = "dummy value";        ViewData["2"] = "dummy value";        ViewData["3"] = "dummy value";        View();    }} View: <%= Html.TextBox("Count") %><%= Html.TextBox("ModelState") %><%= Html.TextBox("Keys") %>&...

Web resources about - Enumerating properties and retrieving values (All methods have failed) - netscape.mozilla.jseng

Not quite enumerating (iterating) enums - Scott Hanselman
Scott Hanselman on Programming, User Experience, The Zen of Computers and Life in General

Enumerating English
How many words are in the English language? 500,000? 1 million? Our linguist says there is no way to really count all the words. What's more, ...

Not quite enumerating (iterating) enums
Warning/Disclaimer: This post is very likely useless and random, providing neither prescriptive guidance nor valuable suggestion. These are the ...

Resources last updated: 1/20/2016 12:07:43 AM