| Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/testharness.js
|
| diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/testharness.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/testharness.js
|
| index 7920ccd4e80e434a24b13978e9aa5db7031881a2..b2198b0f1b2cb8170bd51ef3f82789520114a5c9 100644
|
| --- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/testharness.js
|
| +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/testharness.js
|
| @@ -697,10 +697,17 @@ policies and contribution forms [3].
|
| // instanceof doesn't work if the node is from another window (like an
|
| // iframe's contentWindow):
|
| // http://www.w3.org/Bugs/Public/show_bug.cgi?id=12295
|
| - if ("nodeType" in object &&
|
| - "nodeName" in object &&
|
| - "nodeValue" in object &&
|
| - "childNodes" in object) {
|
| + try {
|
| + var has_node_properties = ("nodeType" in object &&
|
| + "nodeName" in object &&
|
| + "nodeValue" in object &&
|
| + "childNodes" in object);
|
| + } catch (e) {
|
| + // We're probably cross-origin, which means we aren't a node
|
| + return false;
|
| + }
|
| +
|
| + if (has_node_properties) {
|
| try {
|
| object.nodeType;
|
| } catch (e) {
|
| @@ -713,6 +720,44 @@ policies and contribution forms [3].
|
| return false;
|
| }
|
|
|
| + var replacements = {
|
| + "0": "0",
|
| + "1": "x01",
|
| + "2": "x02",
|
| + "3": "x03",
|
| + "4": "x04",
|
| + "5": "x05",
|
| + "6": "x06",
|
| + "7": "x07",
|
| + "8": "b",
|
| + "9": "t",
|
| + "10": "n",
|
| + "11": "v",
|
| + "12": "f",
|
| + "13": "r",
|
| + "14": "x0e",
|
| + "15": "x0f",
|
| + "16": "x10",
|
| + "17": "x11",
|
| + "18": "x12",
|
| + "19": "x13",
|
| + "20": "x14",
|
| + "21": "x15",
|
| + "22": "x16",
|
| + "23": "x17",
|
| + "24": "x18",
|
| + "25": "x19",
|
| + "26": "x1a",
|
| + "27": "x1b",
|
| + "28": "x1c",
|
| + "29": "x1d",
|
| + "30": "x1e",
|
| + "31": "x1f",
|
| + "0xfffd": "ufffd",
|
| + "0xfffe": "ufffe",
|
| + "0xffff": "uffff",
|
| + };
|
| +
|
| /*
|
| * Convert a value to a nice, human-readable string
|
| */
|
| @@ -734,43 +779,9 @@ policies and contribution forms [3].
|
| switch (typeof val) {
|
| case "string":
|
| val = val.replace("\\", "\\\\");
|
| - for (var i = 0; i < 32; i++) {
|
| - var replace = "\\";
|
| - switch (i) {
|
| - case 0: replace += "0"; break;
|
| - case 1: replace += "x01"; break;
|
| - case 2: replace += "x02"; break;
|
| - case 3: replace += "x03"; break;
|
| - case 4: replace += "x04"; break;
|
| - case 5: replace += "x05"; break;
|
| - case 6: replace += "x06"; break;
|
| - case 7: replace += "x07"; break;
|
| - case 8: replace += "b"; break;
|
| - case 9: replace += "t"; break;
|
| - case 10: replace += "n"; break;
|
| - case 11: replace += "v"; break;
|
| - case 12: replace += "f"; break;
|
| - case 13: replace += "r"; break;
|
| - case 14: replace += "x0e"; break;
|
| - case 15: replace += "x0f"; break;
|
| - case 16: replace += "x10"; break;
|
| - case 17: replace += "x11"; break;
|
| - case 18: replace += "x12"; break;
|
| - case 19: replace += "x13"; break;
|
| - case 20: replace += "x14"; break;
|
| - case 21: replace += "x15"; break;
|
| - case 22: replace += "x16"; break;
|
| - case 23: replace += "x17"; break;
|
| - case 24: replace += "x18"; break;
|
| - case 25: replace += "x19"; break;
|
| - case 26: replace += "x1a"; break;
|
| - case 27: replace += "x1b"; break;
|
| - case 28: replace += "x1c"; break;
|
| - case 29: replace += "x1d"; break;
|
| - case 30: replace += "x1e"; break;
|
| - case 31: replace += "x1f"; break;
|
| - }
|
| - val = val.replace(RegExp(String.fromCharCode(i), "g"), replace);
|
| + for (var p in replacements) {
|
| + var replace = "\\" + replacements[p];
|
| + val = val.replace(RegExp(String.fromCharCode(p), "g"), replace);
|
| }
|
| return '"' + val.replace(/"/g, '\\"') + '"';
|
| case "boolean":
|
| @@ -818,7 +829,12 @@ policies and contribution forms [3].
|
|
|
| /* falls through */
|
| default:
|
| - return typeof val + ' "' + truncate(String(val), 60) + '"';
|
| + try {
|
| + return typeof val + ' "' + truncate(String(val), 60) + '"';
|
| + } catch(e) {
|
| + return ("[stringifying object threw " + String(e) +
|
| + " with type " + String(typeof e) + "]");
|
| + }
|
| }
|
| }
|
| expose(format_value, "format_value");
|
| @@ -1438,7 +1454,7 @@ policies and contribution forms [3].
|
| var args = Array.prototype.slice.call(arguments, 2);
|
| return setTimeout(this.step_func(function() {
|
| return f.apply(test_this, args);
|
| - }, timeout * tests.timeout_multiplier));
|
| + }), timeout * tests.timeout_multiplier);
|
| }
|
|
|
| Test.prototype.add_cleanup = function(callback) {
|
|
|