Skip to content

Commit

Permalink
verifies document.writeln works during parsing. the test still unforu…
Browse files Browse the repository at this point in the history
…nately requires a server process as it is in the xhr spec which wont work currently in ff without special permissions. This doesnt solve the blueridge race condition. we need to improve this test out of the box so its easier for users to verify.
  • Loading branch information
thatcher committed Mar 10, 2010
1 parent 29ce8c4 commit c894923
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.xml
Expand Up @@ -165,7 +165,7 @@

<!-- TEST RHINO ENV BINDINGS -->
<target name='rhino-env-spec'
depends='rhino-env'
depends='rhino-env, console'
description='Test Rhino Env Specs'>
<echo message=""/>
<echo message="Executing Rhino Env Spec"/>
Expand All @@ -180,7 +180,7 @@
</target>

<!-- BUILD CONSOLE IMPLEMENTATIOM -->
<target name="console" depends="env-platforms">
<target name="console">
<mkdir dir="${DIST_DIR}" />
<echo message=""/>
<echo message="Building ${CONSOLE_DIST}" />
Expand Down
1 change: 1 addition & 0 deletions src/html/document.js
Expand Up @@ -318,6 +318,7 @@ Aspect.around({
switch(doc.parsing){
case true:
//handled by parser if included
//console.log('html document in parse mode');
break;
case false:
switch(node.namespaceURI){
Expand Down
2 changes: 2 additions & 0 deletions src/parser/htmldocument.js
Expand Up @@ -35,6 +35,7 @@ var __elementPopped__ = function(ns, name, node){
switch(doc.parsing){
case false:
//innerHTML so dont do loading patterns for parsing
//console.log('element popped (implies innerHTML) not in parsing mode %s', node.nodeName);
break;
case true:
switch(doc+''){
Expand All @@ -43,6 +44,7 @@ var __elementPopped__ = function(ns, name, node){
case '[object HTMLDocument]':
switch(node.namespaceURI){
case "http://n.validator.nu/placeholder/":
//console.log('got script during parsing %s', node.textContent);
break;
case null:
case "":
Expand Down
6 changes: 4 additions & 2 deletions src/platform/core/html.js
Expand Up @@ -59,13 +59,15 @@ Envjs.loadLocalScript = function(script){
//ok this script type is allowed
break;
}
if(i+1 == types.length)
if(i+1 == types.length){
//console.log('wont load script type %s', script.type);
return false;
}
}
}

try{
//handle inline scripts
//console.log('handling inline scripts');
if(!script.src.length){
Envjs.loadInlineScript(script);
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/xhr/location.js
Expand Up @@ -122,7 +122,7 @@ Location = function(url, doc, history){
if($document){
//console.log("fetching %s (async? %s)", url, $document.async);
xhr = new XMLHttpRequest();
xhr.open("GET", url, $document.async);
xhr.open("GET", url, false);//$document.async);

if($document.toString()=="[object HTMLDocument]"){
//tell the xhr to not parse the document as XML
Expand Down
2 changes: 2 additions & 0 deletions test/specs/parser/spec.js
Expand Up @@ -228,3 +228,5 @@ test('HTMLParser.parseDocument / malformed content', function(){





3 changes: 3 additions & 0 deletions test/specs/xhr/index.html
Expand Up @@ -36,6 +36,9 @@ <h2 id="qunit-userAgent"></h2>
artifacts the test may require or have generated as
a side effect.
-->
<script>
document.writeln('<div id="writeln"></div>');
</script>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions test/specs/xhr/spec.js
Expand Up @@ -120,3 +120,10 @@ test('XMLHttpRequest async', function(){
xhr.send();
stop();
});


test('HTMLParser document.writeln', function(){

ok(document.getElementById('writeln'), 'document.writeln created a div during parsing');

});

0 comments on commit c894923

Please sign in to comment.