Dear all, Below is the problem i'm stuck at in a Project. Your browser must support javascript. The scope of the problem: - It is related to the interfacing of browser core and Squirrelfish JS Engine via exposed C interfaces by use of JSClassDefinition. Problem Statement: As per our understanding for every DOM document (HTMLPage with JS), we create context and register the DOM objects in engine and at runtime we set or retrieve or process an event via callback mechanism. The problem arises when we try to communicate between the DOM Objects in two different contexts. To explain it further, we have the following html page: <html> <head> <script> function showAlert(){“I am able to call parent function as well!!!!”); </script></head> <body> <iframe src=”frmsrc.html”> </body> </html> The content of the frmsrc.html is given below: - <html> <head> <script> function child() {alert(“I am able to call child function”);} </script> </head> <script> child(); parent.showAlert(); </script> </html> In ideal case in any browser, it should display both the alert messages. In our case, we are getting the alert message in the frmsrc.html i.e: “I am able to call child function”. But when it is trying to access the showAlert() in the parent html it is not accessible. Basically it is not able to access the non standard (user defined) properties/functions of DOM objects in different contexts. Our understanding: Whenever we encounter a page we create a context and initialize Window Object using Squirrelfish APIs. We are not very clear what to be done for the previous context while creating the new context for the new page. We have the browser core code in C so we are forced to use the callback mechanism to interact with Squirrelfish Engine. (i.e; - registering all attributes and functions for the Object during context creation while initializing the Window Class and then getting callback at run time). We are not sure what is do be done for communication of DOM objects across contexts. Best Regards, Mohit Kingra Loading... 1 Ctrl+FSearch the document F3Find next Shift+F3Find previous Edit online Download original Save in Google Docs Ctrl+PPrint (PDF) Zoom in Zoom out Fit page to screen Fit two pages to screen Shift+Ctrl+FCompact controls Plain HTML
Dear all, Below is the problem i'm stuck at in a Project. The scope of the problem: - It is related to the interfacing of browser core and Squirrelfish JS Engine via exposed C interfaces by use of JSClassDefinition. Problem Statement: As per our understanding for every DOM document (HTMLPage with JS), we create context and register the DOM objects in engine and at runtime we set or retrieve or process an event via callback mechanism. The problem arises when we try to communicate between the DOM Objects in two different contexts. To explain it further, we have the following html page: <html> <head> <script> function showAlert(){“I am able to call parent function as well!!!!”); </script></head> <body> <iframe src=”frmsrc.html”> </body> </html> The content of the frmsrc.html is given below: - <html> <head> <script> function child() {alert(“I am able to call child function”);} </script> </head> <script> child(); parent.showAlert(); </script> </html> In ideal case in any browser, it should display both the alert messages. In our case, we are getting the alert message in the frmsrc.html i.e: “I am able to call child function”. But when it is trying to access the showAlert() in the parent html it is not accessible. Basically it is not able to access the non standard (user defined) properties/functions of DOM objects in different contexts. Our understanding: Whenever we encounter a page we create a context and initialize Window Object using Squirrelfish APIs. We are not very clear what to be done for the previous context while creating the new context for the new page. We have the browser core code in C so we are forced to use the callback mechanism to interact with Squirrelfish Engine. (i.e; - registering all attributes and functions for the Object during context creation while initializing the Window Class and then getting callback at run time). We are not sure what is do be done for communication of DOM objects across contexts. Best Regards, Mohit Kingra
Hi Mohit, it's good to see a new project using the JavaScriptCore APIs. Unfortunately what you're describing clearly involves the entirety of WebKit (because you're interacting with a webpage). So we need some more information before we can provide meaningful assistance. The most important information we need to know is what platform you are using webkit on as they all have slightly different APIs -- are you using the Mac, Gtk, Qt, or Windows, etc port? Following on from that how are you injecting your new methods and properties? --Oliver On Oct 27, 2010, at 11:56 AM, mohit kingra wrote:
Dear all,
Below is the problem i'm stuck at in a Project.
The scope of the problem: - It is related to the interfacing of browser core and Squirrelfish JS Engine via exposed C interfaces by use of JSClassDefinition.
Problem Statement: As per our understanding for every DOM document (HTMLPage with JS), we create context and register the DOM objects in engine and at runtime we set or retrieve or process an event via callback mechanism. The problem arises when we try to communicate between the DOM Objects in two different contexts. To explain it further, we have the following html page: <html> <head> <script> function showAlert(){“I am able to call parent function as well!!!!”); </script></head> <body> <iframe src=”frmsrc.html”> </body> </html> The content of the frmsrc.html is given below: - <html> <head> <script> function child() {alert(“I am able to call child function”);} </script> </head> <script> child(); parent.showAlert(); </script> </html> In ideal case in any browser, it should display both the alert messages. In our case, we are getting the alert message in the frmsrc.html i.e: “I am able to call child function”. But when it is trying to access the showAlert() in the parent html it is not accessible. Basically it is not able to access the non standard (user defined) properties/functions of DOM objects in different contexts.
Our understanding: Whenever we encounter a page we create a context and initialize Window Object using Squirrelfish APIs. We are not very clear what to be done for the previous context while creating the new context for the new page. We have the browser core code in C so we are forced to use the callback mechanism to interact with Squirrelfish Engine. (i.e; - registering all attributes and functions for the Object during context creation while initializing the Window Class and then getting callback at run time). We are not sure what is do be done for communication of DOM objects across contexts.
Best Regards,
Mohit Kingra
_______________________________________________ squirrelfish-dev mailing list squirrelfish-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
Hi All, First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit. The Platform we are working on is Gtk on Linux. Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore. Best Regards, Mohit On Thu, Oct 28, 2010 at 12:30 AM, Oliver Hunt <oliver@apple.com> wrote:
Hi Mohit, it's good to see a new project using the JavaScriptCore APIs.
Unfortunately what you're describing clearly involves the entirety of WebKit (because you're interacting with a webpage). So we need some more information before we can provide meaningful assistance.
The most important information we need to know is what platform you are using webkit on as they all have slightly different APIs -- are you using the Mac, Gtk, Qt, or Windows, etc port?
Following on from that how are you injecting your new methods and properties?
--Oliver
On Oct 27, 2010, at 11:56 AM, mohit kingra wrote:
Dear all,
Below is the problem i'm stuck at in a Project.
The scope of the problem: - It is related to the interfacing of browser core and Squirrelfish JS Engine via exposed C interfaces by use of JSClassDefinition.
Problem Statement: As per our understanding for every DOM document (HTMLPage with JS), we create context and register the DOM objects in engine and at runtime we set or retrieve or process an event via callback mechanism. The problem arises when we try to communicate between the DOM Objects in two different contexts. To explain it further, we have the following html page: <html> <head> <script> function showAlert(){“I am able to call parent function as well!!!!”); </script></head> <body> <iframe src=”frmsrc.html”> </body> </html> The content of the frmsrc.html is given below: - <html> <head> <script> function child() {alert(“I am able to call child function”);} </script> </head> <script> child(); parent.showAlert(); </script> </html> In ideal case in any browser, it should display both the alert messages. In our case, we are getting the alert message in the frmsrc.html i.e: “I am able to call child function”. But when it is trying to access the showAlert() in the parent html it is not accessible. Basically it is not able to access the non standard (user defined) properties/functions of DOM objects in different contexts.
Our understanding: Whenever we encounter a page we create a context and initialize Window Object using Squirrelfish APIs. We are not very clear what to be done for the previous context while creating the new context for the new page. We have the browser core code in C so we are forced to use the callback mechanism to interact with Squirrelfish Engine. (i.e; - registering all attributes and functions for the Object during context creation while initializing the Window Class and then getting callback at run time). We are not sure what is do be done for communication of DOM objects across contexts.
Best Regards,
Mohit Kingra
_______________________________________________ squirrelfish-dev mailing list squirrelfish-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
On Oct 27, 2010, at 9:02 PM, mohit kingra wrote:
Hi All,
First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit.
The Platform we are working on is Gtk on Linux.
Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore.
Do your custom properties exist on any of the browser objects? --Oliver
No, we haven't registered any custom properties for Browser Objects. On Thu, Oct 28, 2010 at 9:40 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:02 PM, mohit kingra wrote:
Hi All,
First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit.
The Platform we are working on is Gtk on Linux.
Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore.
Do your custom properties exist on any of the browser objects?
--Oliver
On Oct 27, 2010, at 9:14 PM, mohit kingra wrote:
No, we haven't registered any custom properties for Browser Objects.
On Thu, Oct 28, 2010 at 9:40 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:02 PM, mohit kingra wrote:
Hi All,
First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit.
The Platform we are working on is Gtk on Linux.
Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore.
Do your custom properties exist on any of the browser objects?
I meant to ask are you aware of your custom properties every being present? What do you mean by your interface code to squirrelfish? JavaScriptCore is the API you should be using -- squirrelfish is just the execution engine so if you're circumventing the APIs you may encounter all sorts of problems. It may be helpful if you give some sample code to show us how you're using the api, as that will make it easier for us to understand what's happening and why your properties aren't showing up. --Oliver
Hi Oliver... How we are using C API set provided by JavaScriptCore framework is described below:- example- Initialization of Window Object in Window.cpp static JSClassDefinition classDefinition = { 0, /* current (and only) version is 0 */ kJSClassAttributeNone, /*JSClassAttributes*/ "Window", 0, /*JSClassRef*/ WindowProps, /*const JSStaticValue* staticValues; */ WindowMethods, /*const JSStaticFunction* staticFunctions;*/ NULL, /*JSObjectInitializeCallback initialize*/ Window_Finalize, /*JSObjectFinalizeCallback*/ Window_HasProperty,/*JSObjectHasPropertyCallback */ Window_GetProperty, /*JSObjectGetPropertyCallback*/ Window_SetProperty, //NULL, /*JSObjectSetPropertyCallback */ NULL, /*JSObjectDeletePropertyCallback*/ NULL, /*JSObjectGetPropertyNamesCallback*/ NULL, /* JSObjectCallAsFunctionCallback*/ NULL, /* JSObjectCallAsConstructorCallback*/ NULL, /* JSObjectHasInstanceCallback*/ NULL /*JSObjectConvertToTypeCallback*/ }; InitWindowClass() { ............. GlobalObjectClass = JSClassCreate(&classDefinition); pJsCx = JSGlobalContextCreate( GlobalObjectClass); pWinObj = JSContextGetGlobalObject(pJsCx); register pWinObj with a DOM's structure holding all the objects made like above ......... ......... } See,The standard properties/Methods are accesible if defined in WindowProp/WindowMethods as Window Object is made Right. The problem is in accesing JavaScript Objects using parent keyword. Mohit On Thu, Oct 28, 2010 at 9:48 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:14 PM, mohit kingra wrote:
No, we haven't registered any custom properties for Browser Objects.
On Thu, Oct 28, 2010 at 9:40 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:02 PM, mohit kingra wrote:
Hi All,
First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit.
The Platform we are working on is Gtk on Linux.
Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore.
Do your custom properties exist on any of the browser objects?
I meant to ask are you aware of your custom properties every being present?
What do you mean by your interface code to squirrelfish? JavaScriptCore is the API you should be using -- squirrelfish is just the execution engine so if you're circumventing the APIs you may encounter all sorts of problems.
It may be helpful if you give some sample code to show us how you're using the api, as that will make it easier for us to understand what's happening and why your properties aren't showing up.
--Oliver
On Oct 27, 2010, at 9:42 PM, mohit kingra wrote:
Hi Oliver...
How we are using C API set provided by JavaScriptCore framework is described below:-
example- Initialization of Window Object in Window.cpp
static JSClassDefinition classDefinition = { 0, /* current (and only) version is 0 */ kJSClassAttributeNone, /*JSClassAttributes*/
"Window", 0, /*JSClassRef*/ WindowProps, /*const JSStaticValue* staticValues; */ WindowMethods, /*const JSStaticFunction* staticFunctions;*/ NULL, /*JSObjectInitializeCallback initialize*/ Window_Finalize, /*JSObjectFinalizeCallback*/ Window_HasProperty,/*JSObjectHasPropertyCallback */ Window_GetProperty, /*JSObjectGetPropertyCallback*/ Window_SetProperty, //NULL, /*JSObjectSetPropertyCallback */ NULL, /*JSObjectDeletePropertyCallback*/ NULL, /*JSObjectGetPropertyNamesCallback*/ NULL, /* JSObjectCallAsFunctionCallback*/ NULL, /* JSObjectCallAsConstructorCallback*/ NULL, /* JSObjectHasInstanceCallback*/ NULL /*JSObjectConvertToTypeCallback*/ };
InitWindowClass() { ............. GlobalObjectClass = JSClassCreate(&classDefinition); pJsCx = JSGlobalContextCreate( GlobalObjectClass);
pWinObj = JSContextGetGlobalObject(pJsCx);
register pWinObj with a DOM's structure holding all the objects made like above ......... ......... }
See,The standard properties/Methods are accesible if defined in WindowProp/WindowMethods as Window Object is made Right. The problem is in accesing JavaScript Objects using parent keyword.
What do you mean by "parent"? Are any of the properties you're trying to access being provided by the Window_GetProperty callback? If so is Window_GetProperty consistent with Window_HasProperty? --Oliver
Mohit
On Thu, Oct 28, 2010 at 9:48 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:14 PM, mohit kingra wrote:
No, we haven't registered any custom properties for Browser Objects.
On Thu, Oct 28, 2010 at 9:40 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:02 PM, mohit kingra wrote:
Hi All,
First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit.
The Platform we are working on is Gtk on Linux.
Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore.
Do your custom properties exist on any of the browser objects?
I meant to ask are you aware of your custom properties every being present?
What do you mean by your interface code to squirrelfish? JavaScriptCore is the API you should be using -- squirrelfish is just the execution engine so if you're circumventing the APIs you may encounter all sorts of problems.
It may be helpful if you give some sample code to show us how you're using the api, as that will make it easier for us to understand what's happening and why your properties aren't showing up.
--Oliver
Hi Oliver, thanks for your replies but fortunately today turned out to be our lucky day after working for a week on this problem as it is solved now The problem was with the creation of context which we were creating each time window object was created. What solved the problem was that all the contexts were needed to be part of a global context group which we created using JSGlobalContextCreateinGroup() instead of JSContextGlobalCreate() as shown in the code posted above. The parent is the keyword needed to access objects/functions in a window from a child window e.g. iframe. Before the above described change we were unable to execute parent.function_name() from inside an iframe as context of parent window was not accessible from child window(iframe). Regards, Mohit parent is the keyword to access the On Thu, Oct 28, 2010 at 9:26 PM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:42 PM, mohit kingra wrote:
Hi Oliver...
How we are using C API set provided by JavaScriptCore framework is described below:-
example- Initialization of Window Object in Window.cpp
static JSClassDefinition classDefinition = { 0, /* current (and only) version is 0 */ kJSClassAttributeNone, /*JSClassAttributes*/
"Window", 0, /*JSClassRef*/ WindowProps, /*const JSStaticValue* staticValues; */ WindowMethods, /*const JSStaticFunction* staticFunctions;*/ NULL, /*JSObjectInitializeCallback initialize*/ Window_Finalize, /*JSObjectFinalizeCallback*/ Window_HasProperty,/*JSObjectHasPropertyCallback */ Window_GetProperty, /*JSObjectGetPropertyCallback*/ Window_SetProperty, //NULL, /*JSObjectSetPropertyCallback */ NULL, /*JSObjectDeletePropertyCallback*/ NULL, /*JSObjectGetPropertyNamesCallback*/ NULL, /* JSObjectCallAsFunctionCallback*/ NULL, /* JSObjectCallAsConstructorCallback*/ NULL, /* JSObjectHasInstanceCallback*/ NULL /*JSObjectConvertToTypeCallback*/ };
InitWindowClass() { ............. GlobalObjectClass = JSClassCreate(&classDefinition); pJsCx = JSGlobalContextCreate( GlobalObjectClass);
pWinObj = JSContextGetGlobalObject(pJsCx);
register pWinObj with a DOM's structure holding all the objects made like above ......... ......... }
See,The standard properties/Methods are accesible if defined in WindowProp/WindowMethods as Window Object is made Right. The problem is in accesing JavaScript Objects using parent keyword.
What do you mean by "parent"?
Are any of the properties you're trying to access being provided by the Window_GetProperty callback? If so is Window_GetProperty consistent with Window_HasProperty?
--Oliver
Mohit
On Thu, Oct 28, 2010 at 9:48 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:14 PM, mohit kingra wrote:
No, we haven't registered any custom properties for Browser Objects.
On Thu, Oct 28, 2010 at 9:40 AM, Oliver Hunt <oliver@apple.com> wrote:
On Oct 27, 2010, at 9:02 PM, mohit kingra wrote:
Hi All,
First thing first, The BrowserCore is not WebCore of Webkit, its our own. We are only using JavaScriptCore Library from WebKit.
The Platform we are working on is Gtk on Linux.
Methods/Properties of Browser Objects or Custom Objects are registered as Callbacks using JSClassDefinition structure(JavaScriptCore APIs) in our Interface Code for SquirrelFish and BrowserCore.
Do your custom properties exist on any of the browser objects?
I meant to ask are you aware of your custom properties every being present?
What do you mean by your interface code to squirrelfish? JavaScriptCore is the API you should be using -- squirrelfish is just the execution engine so if you're circumventing the APIs you may encounter all sorts of problems.
It may be helpful if you give some sample code to show us how you're using the api, as that will make it easier for us to understand what's happening and why your properties aren't showing up.
--Oliver
participants (2)
-
mohit kingra
-
Oliver Hunt