Skip to content

Commit

Permalink
Merge branch 'master' of gitproxy:glow/glow1
Browse files Browse the repository at this point in the history
  • Loading branch information
Frances Berriman committed Sep 25, 2009
2 parents bcb94ed + 8200a62 commit 42ab7a4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/dom/dom.js
Expand Up @@ -2503,6 +2503,7 @@
length = this.length;

if (newHtml !== undefined) {
// not setting innerHTML, doesn't work in IE for elements like <table>
return this.empty().append(newHtml);
}
return this[0] ? this[0].innerHTML : "";
Expand Down
2 changes: 2 additions & 0 deletions src/net/net.js
Expand Up @@ -147,6 +147,7 @@
} else {
events.fire(request, "error", response);
}
// prevent parent scopes leaking (cross-page) in IE
req.onreadystatechange = new Function();
}
};
Expand Down Expand Up @@ -375,6 +376,7 @@
//different if request came from loadScript
if (nativeReq) {
//clear listeners
// prevent parent scopes leaking (cross-page) in IE
nativeReq.onreadystatechange = new Function();
nativeReq.abort();
} else if (callbackIndex) {
Expand Down
17 changes: 12 additions & 5 deletions test/glow/embed/embed.js
Expand Up @@ -36,7 +36,8 @@ t.test("Test Embedding", function() {

if (!movie.movie) {
flashHolder.destroy();
t.skip("Flash 9 or greater required"); return;
t.skip("Flash 9 or greater required");
return;
}

t.ok(movie.movie.nodeName.toLowerCase() == embed_tag, "Movie property references Flash")
Expand Down Expand Up @@ -147,7 +148,8 @@ t.test("check that supplied attributes are set correctly", function() {

if (!movie.movie) {
flashHolder.destroy();
t.skip("Flash 6 or greater required"); return;
t.skip("Flash 6 or greater required");
return;
}

t.ok($("#testFlash")[0].tagName.toLowerCase() == embed_tag,"set id");
Expand Down Expand Up @@ -181,7 +183,8 @@ t.test("Shortcut attribute setting", function() {

if (!myFlash.movie) {
flashHolder.destroy();
t.skip("Flash 6 or greater required"); return;
t.skip("Flash 6 or greater required");
return;
}

t.equals(myFlash.movie.id, "newIdValue", "ID");
Expand All @@ -202,13 +205,17 @@ t.test("check correct defaults for missing parameters", function() {

if (!movie.movie) {
flashHolder.destroy();
t.skip("Flash 6 or greater required"); return;
t.skip("Flash 6 or greater required");
return;
}

try {
//not using getAttribute for the first two as some browsers give empty strings while others give null
t.ok(embed.id != "","Movie has auto-generated ID");
t.ok(embed.name == "" || embed.name == undefined,"no name by default");

var hasName = embed.name != "" || embed.name != undefined;

t.ok( !hasName, "no name by default" );
if (glow.env.ie) {
t.ok($(embed).children().filter(function() { return this.name == "allowscriptaccess" }).attr("value") == "always", "allowscriptaccess:always");
} else {
Expand Down
5 changes: 4 additions & 1 deletion test/glow/glow.js
Expand Up @@ -8,7 +8,10 @@ t.test("Basic requirements", function() {

t.test("Simple DOM Ready testing", function() {
t.expect(4);
if (glow.isReady) { t.skip("DOM already ready"); return; }
if (glow.isReady) {
t.skip("DOM already ready");
return;
}
t.stop();

var firstFired = false;
Expand Down
27 changes: 17 additions & 10 deletions test/glow/net/net.js
Expand Up @@ -68,7 +68,8 @@ t.test("glow.net.get async header setting", function() {
onLoad: function(response) {
if ( response.text().slice(0, 2) == '<?' ) {
t.start();
t.skip("This test requires a web server running PHP5"); return;
t.skip("This test requires a web server running PHP5");
return;
}
t.ok(true, "correct callback used");
t.ok(/^REQUEST_METHOD: GET/m.test(response.text()), "Using get method");
Expand Down Expand Up @@ -182,7 +183,8 @@ t.test("glow.net.post async string", function() {
onLoad: function(response) {
if ( response.text().slice(0, 2) == '<?' ) {
t.start();
t.skip("This test requires a web server running PHP5"); return;
t.skip("This test requires a web server running PHP5");
return;
}
t.ok(true, "correct callback used");
t.equals( (/^REQUEST_METHOD: (\w+)/m.exec(response.text()) || [,,])[1], "POST", "Using post method" );
Expand All @@ -206,7 +208,8 @@ t.test("glow.net.post aync json", function() {
onLoad: function(response) {
if ( response.text().slice(0, 2) == '<?' ) {
t.start();
t.skip("This test requires a web server running PHP5"); return;
t.skip("This test requires a web server running PHP5");
return;
}
t.ok(true, "correct callback used");
t.equals( (/^REQUEST_METHOD: (\w+)/m.exec(response.text()) || [,,])[1], "POST", "Using post method" );
Expand Down Expand Up @@ -289,17 +292,19 @@ t.test("glow.net.get defering and multiple error events", function() {


//test redirects
for (var i = 1; i < 5; i++) {
if (i == 4) i = 7;
var redirectCodes = [301, 302, 303, 307];

for (var i = 0, len = redirectCodes.length; i < len; i++) {
(function(i) {
t.test("glow.net.get redirect 30" + i, function() {
t.test("glow.net.get redirect " + redirectCodes[i], function() {
t.expect(2);
t.stop();
glow.net.get("testdata/xhr/redirect.php?code=" + i, {
glow.net.get("testdata/xhr/redirect.php?code=" + redirectCodes[i], {
onLoad: function(response) {
if ( response.text().slice(0,2) == '<?' ) {
t.start();
t.skip("This test requires a web server running PHP5"); return;
t.skip("This test requires a web server running PHP5");
return;
}
t.ok(true, "onLoad called");
t.equals(response.text(), "XHR Test Document", "File returned");
Expand All @@ -308,7 +313,8 @@ for (var i = 1; i < 5; i++) {
onError: function(response) {
if ( response.text().slice(0,2) == '<?' ) {
t.start();
t.skip("This test requires a web server running PHP5"); return;
t.skip("This test requires a web server running PHP5");
return;
}
t.ok(false, "onLoad called");
t.equals(response.text(), "XHR Test Document", "File returned");
Expand Down Expand Up @@ -407,7 +413,8 @@ t.test("glow.net.loadScript aborting", function() {
timeout: 2
});
if (request.completed) {
t.skip("Request complete, too late to abort"); return;
t.skip("Request complete, too late to abort");
return;
}
request.abort();

Expand Down

0 comments on commit 42ab7a4

Please sign in to comment.