AngleSharp / AngleSharp.Js

:angel: Extends AngleSharp with a .NET-based JavaScript engine.
https://anglesharp.github.io
MIT License
105 stars 23 forks source link

Extending `Window` is not possible #6

Closed FlorianRappl closed 9 years ago

FlorianRappl commented 9 years ago

Originally issue FlorianRappl/AngleSharp#44 (4):

Trying

window.foo = 'bla'; console.log(window.foo);

results in JS error because of the way window is set as the context in JavaScriptEngine.Evaluate. I worked around this by not returning a new DomNodeInstance from ToJSValue in DomFunctionInstance.Call if the _method.Invoke result is reference equals to node.Value. Instead I returned node.Value directly.

FlorianRappl commented 9 years ago

This is actually a problem in AngleSharp. The proxy returns null, as the window of the document is not the active one yet.