You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script language="JavaScript">
var opt_msg1_exist = "_mode_on";
if( opt_msg1_exist == "_mode_on")
{
var opt_msg1_name = '>Português';
}
var OEMFlag = 0;
if( OEMFlag == 0 || OEMFlag == 2)
{
document.write('<title>Kyocera Command Center</title>');
document.write('');
}
else
document.write('<title></title>');
var lang="rus";
var ModelName="FS-3040MFP+";
var IEMsgShown = false;
var currentpage="";
var testData = new Array();
testData[0] = 0;
var curPageFlag = false;
</script>
When run start.htm that have into javascript where set var:
Line 45: parent.FaxNum = FaxNum;
Line 48: parent.CipherCheck = 1;
Line 50: parent.CipherCheck = 0;
etc
As result
Script parsing stops with an error "ReferenceError: parent is not defined"
Steps to Reproduce
[First Step]
var srvJsScripting = new JsScriptingService();
var srvNavigator = new Navigator();
var config = Configuration.Default.WithDefaultLoader(new LoaderOptions { IsResourceLoadingEnabled = true }).With(srvNavigator)
.WithLocaleBasedEncoding().WithCulture("ru-ru").With(srvJsScripting);
var context = BrowsingContext.New(config);
var queryDocument = context.OpenAsync("http://mfu01.al.loc").Result;
[Second Step]
When page start.htm is was processed throw exception "ReferenceError: parent is not defined" and treatment of script is stopped and run next script where into have "parent.Var = " and this have the same error
[and so on...]
Expected behavior:
I want to get variables from the environment of the parent window, read and write data from the child window Actual behavior:
throw exception "ReferenceError: parent is not defined" Environment details:
VS 2019, last version of AngleSharp.JS
I found a connection between the current window and the parent. And I was able to get the instance with the variables of the parent window.
var oParent = Window->Document->Context->Parent->Current;
next get instance from document
...\AngleSharp.Js\v.0.14.0\src\AngleSharp.Js\JsScriptingService.cs (line 104)
internal EngineInstance GetOrCreateInstance(IDocument document)
{
var objectContext = document.DefaultView;
if (!_contexts.TryGetValue(objectContext, out var instance))
{
var libs = GetAssemblies(document.Context).ToArray();
instance = new EngineInstance(objectContext, _external, libs);
_contexts.Add(objectContext, instance);
}
return instance;
}
It's on my knee, but I would like to get a competent code
Bug Report
Prerequisites
AngleSharp.Css
for CSS support)For more information, see the
CONTRIBUTING
guide.Description
I am parsing Kyocera FS-3040MFP+
Index page have frame set
frameset border=0 cols=* frameborder=NO framespacing=0 rows=1,*
frame name=topframe noResize scrolling=no src="../top.htm"
frame name=main src="../start/start.htm"
and javascript that have same vars
<script language="JavaScript"> var opt_msg1_exist = "_mode_on"; if( opt_msg1_exist == "_mode_on") { var opt_msg1_name = '>Português'; } var OEMFlag = 0; if( OEMFlag == 0 || OEMFlag == 2) { document.write('<title>Kyocera Command Center</title>'); document.write(''); } else document.write('<title></title>'); var lang="rus"; var ModelName="FS-3040MFP+"; var IEMsgShown = false; var currentpage=""; var testData = new Array(); testData[0] = 0; var curPageFlag = false; </script>When run start.htm that have into javascript where set var:
Line 45: parent.FaxNum = FaxNum;
Line 48: parent.CipherCheck = 1;
Line 50: parent.CipherCheck = 0;
etc
As result
Script parsing stops with an error "ReferenceError: parent is not defined"
Steps to Reproduce
[First Step]
var srvJsScripting = new JsScriptingService();
var srvNavigator = new Navigator();
var config = Configuration.Default.WithDefaultLoader(new LoaderOptions { IsResourceLoadingEnabled = true }).With(srvNavigator)
.WithLocaleBasedEncoding().WithCulture("ru-ru").With(srvJsScripting);
var context = BrowsingContext.New(config);
var queryDocument = context.OpenAsync("http://mfu01.al.loc").Result;
[Second Step]
When page start.htm is was processed throw exception "ReferenceError: parent is not defined" and treatment of script is stopped and run next script where into have "parent.Var = " and this have the same error
[and so on...]
Expected behavior:
I want to get variables from the environment of the parent window, read and write data from the child window
Actual behavior:
throw exception "ReferenceError: parent is not defined"
Environment details:
VS 2019, last version of AngleSharp.JS
Possible Solution
Add a property "parent" to the object "Window" to have access to the variables of the parent page
https://developer.mozilla.org/en-US/docs/Web/API/Window/parent
The text was updated successfully, but these errors were encountered: