72
71
compare(spy.count, 2, "Should have had a signal");
73
72
compare(req.onerror, null, "Unexpected handler");
76
function test_ScriptMessageRequest3_invalid_dest() {
77
var req = webView.rootFrame.sendMessage("http://foo/", "GET-DOCUMENT-URI", {});
80
req.onerror = function(code, msg) {
85
verify(webView.waitFor(function() { return hasError; }),
86
"Timed out waiting for error");
87
compare(errorCode, ScriptMessageRequest.ErrorDestinationNotFound,
88
"Unexpected error code");
91
function test_ScriptMessageRequest4_handler_throws() {
92
var req = webView.rootFrame.sendMessage("oxide://testutils/", "GENERATE-JS-EXCEPTION", {});
95
req.onerror = function(code, msg) {
100
verify(webView.waitFor(function() { return hasError; }),
101
"Timed out waiting for error");
102
compare(errorCode, ScriptMessageRequest.ErrorUncaughtException,
103
"Unexpected error code");
106
function test_ScriptMessageRequest5_no_handler() {
107
var req = webView.rootFrame.sendMessage("oxide://testutils/", "BLAAAAAAAAAAAAAH", {});
108
var hasError = false;
110
req.onerror = function(code, msg) {
115
verify(webView.waitFor(function() { return hasError; }),
116
"Timed out waiting for error");
117
compare(errorCode, ScriptMessageRequest.ErrorNoHandler,
118
"Unexpected error code");
121
function test_ScriptMessageRequest6_handler_report_error() {
122
var req = webView.rootFrame.sendMessage("oxide://testutils/", "EVALUATE-CODE", { code: "foo" });
123
var hasError = false;
125
req.onerror = function(code, msg) {
130
verify(webView.waitFor(function() { return hasError; }),
131
"Timed out waiting for error");
132
compare(errorCode, ScriptMessageRequest.ErrorHandlerReportedError,
133
"Unexpected error code");
136
function test_ScriptMessageRequest7_handler_no_response() {
137
skip("Currently times out because the renderer side object is never collected");
140
var req = webView.rootFrame.sendMessage("oxide://testutils/", "DONT-RESPOND", {});
141
var hasError = false;
143
req.onerror = function(code, msg) {
148
verify(webView.waitFor(function() { return hasError; }),
149
"Timed out waiting for error");
150
compare(errorCode, ScriptMessageRequest.ErrorHandlerDidNotRespond,
151
"Unexpected error code");