@@ -1401,7 +1401,8 @@ public boolean setText(String html) {
1401
1401
try {
1402
1402
var doc = handle.contentWindow.document;
1403
1403
doc.open ();
1404
- if (O$.isIE) {
1404
+ if (O$.isIE && window["xss.domain.enabled"] == true
1405
+ && domain != null && domain.length > 0) {
1405
1406
doc.domain = domain;
1406
1407
}
1407
1408
doc.write (html);
@@ -1420,12 +1421,17 @@ public boolean setText(String html) {
1420
1421
* @j2sNative
1421
1422
var handle = arguments[0];
1422
1423
var html = arguments[1];
1423
- var domain = document.domain;
1424
- if (O$.isIE) {
1424
+ var domain = null;
1425
+ try {
1426
+ domain = document.domain;
1427
+ } catch (e) {}
1428
+ if (O$.isIE && window["xss.domain.enabled"] == true
1429
+ && domain != null && domain.length > 0) {
1425
1430
document.domain = domain;
1426
1431
}
1427
1432
if (handle.contentWindow != null) {
1428
- if (O$.isIE) {
1433
+ if (O$.isIE && window["xss.domain.enabled"] == true
1434
+ && domain != null && domain.length > 0) {
1429
1435
handle.contentWindow.location = "javascript:document.open();document.domain='" + domain + "';document.close();void(0);";
1430
1436
} else {
1431
1437
handle.contentWindow.location = "about:blank";
@@ -1436,13 +1442,24 @@ public boolean setText(String html) {
1436
1442
try {
1437
1443
var doc = handle.contentWindow.document;
1438
1444
doc.open ();
1439
- if (O$.isIE) {
1445
+ if (O$.isIE && window["xss.domain.enabled"] == true
1446
+ && domain != null && domain.length > 0) {
1440
1447
doc.domain = domain;
1441
1448
}
1442
1449
doc.write (html);
1443
1450
doc.close ();
1444
1451
} catch (e) {
1445
- window.setTimeout (this.generateLazyIframeWriting (handle, domain, html), 25);
1452
+ if (O$.isIE && (domain == null || domain.length == 0)
1453
+ && e.message != null && e.message.indexOf ("Access is denied") != -1) {
1454
+ var jsHTML = html.replaceAll("\\\\", "\\\\\\\\")
1455
+ .replaceAll("\r", "\\\\r")
1456
+ .replaceAll("\n", "\\\\n")
1457
+ .replaceAll("\"", "\\\\\"");
1458
+ handle.src = "javascript:document.open();document.write (\"" + jsHTML + "\");document.close();void(0);";
1459
+ // In IE 8.0, it is still failing ...
1460
+ } else {
1461
+ window.setTimeout (this.generateLazyIframeWriting (handle, domain, html), 25);
1462
+ }
1446
1463
}
1447
1464
*/
1448
1465
private native void iframeDocumentWrite (Object handle , String html );
0 commit comments