DotNetBrowser  1.14
Public Member Functions | Protected Member Functions | Properties | Events | List of all members
DotNetBrowser.JSContext Class Reference

Represents JavaScript execution context. Each frame on the web page has it's own execution context. JavaScript objects created in one context will not be visible and accessible in other contexts. More...

Inherits IDisposable.

Public Member Functions

void Dispose ()
 Disposes current context More...
 
override bool Equals (object obj)
 Determines whether the specified JSContext is equal to the current JSContext. More...
 
override int GetHashCode ()
 Serves as a hash function for a particular type. More...
 
JSObject CreateObject ()
 Create a new empty JavaScript object instance that is available in scope of the current execution context. More...
 

Protected Member Functions

void Dispose (bool disposing)
 

Properties

long FrameId [get]
 Returns unique identifier of a frame which is associated this this JavaScript execution context. This method returns valid identifier even when context is disposed and frame with this ID doesn't exist anymore. Use this method only in combination with the IsDisposed property. More...
 
long WorldId [get]
 Gets JavaScript world identifier associated with the current context. More...
 
bool IsDisposed [get]
 Indicates whether context is disposed or not. JavaScript context is disposed automatically when its frame is being unloaded. All JavaScript objects associated with this context will be disposed automaticall More...
 

Events

EventHandler DisposeEvent
 An event that indicates that context instance disposed. More...
 

Detailed Description

Represents JavaScript execution context. Each frame on the web page has it's own execution context. JavaScript objects created in one context will not be visible and accessible in other contexts.

JavaScript context is initialized and created automatically for each frame on the loaded web page only if this frame has JavaScript code. If frame doesn't have JavaScript code, context will not be created for this frame. To force context creation you can call Browser.ExecuteJavaScriptAndReturnValue(long, String)} method for required frame.

When frame is reloaded or another web page is loaded, all existing contexts will be destroyed and new contexts will be created. To check whether context is destroyed get the IsDisposed property or use DisposedEvent.

Member Function Documentation

JSObject DotNetBrowser.JSContext.CreateObject ( )

Create a new empty JavaScript object instance that is available in scope of the current execution context.

Returns
a new empty JavaScript object instance that is available in scope of the current execution context.
Exceptions
InvalidOperationExceptionwhen context is not valid anymore and disposed.
void DotNetBrowser.JSContext.Dispose ( )

Disposes current context

override bool DotNetBrowser.JSContext.Equals ( object  obj)

Determines whether the specified JSContext is equal to the current JSContext.

Parameters
objThe object to compare with the current JSContext object.
Returns
true if the specified object is equal to the current JSContext object; otherwise, false.
override int DotNetBrowser.JSContext.GetHashCode ( )

Serves as a hash function for a particular type.

Returns
A hash code for the current JSContext.

Property Documentation

long DotNetBrowser.JSContext.FrameId
get

Returns unique identifier of a frame which is associated this this JavaScript execution context. This method returns valid identifier even when context is disposed and frame with this ID doesn't exist anymore. Use this method only in combination with the IsDisposed property.

bool DotNetBrowser.JSContext.IsDisposed
get

Indicates whether context is disposed or not. JavaScript context is disposed automatically when its frame is being unloaded. All JavaScript objects associated with this context will be disposed automaticall

long DotNetBrowser.JSContext.WorldId
get

Gets JavaScript world identifier associated with the current context.

Event Documentation

EventHandler DotNetBrowser.JSContext.DisposeEvent

An event that indicates that context instance disposed.