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