Skip to content

ReferenceError: parent is not defined #68

Open
@and-nord

Description

Bug Report

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
  • Did you perform a search in the issues?

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

  1. [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;

  2. [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

  3. [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

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions