// Test routes expecting a certain method if (method) { const responseText = await requestJSON(route, {
method: "DELETE",
status: 405,
json: false,
});
is(
responseText,
`Using unsafe HTTP verb DELETE to invoke ${route}. This action supports only ${method} verb.`, "/json/new fails with 405 when using GET"
);
}
}
});
Assert.deepEqual(json, jsonAlias, "/json/list and /json return the same");
ok(Array.isArray(json), "Target list is an array");
is(
json.length,
targetInfos.length, "Targets as listed on /json/list are equal to Target.getTargets"
);
for (let i = 0; i < json.length; i++) { const jsonTarget = json[i]; const wsTarget = targetInfos[i];
is(
jsonTarget.id,
wsTarget.targetId, "Target id matches between HTTP and Target.getTargets"
);
is(
jsonTarget.type,
wsTarget.type, "Target type matches between HTTP and Target.getTargets"
);
is(
jsonTarget.url,
wsTarget.url, "Target url matches between HTTP and Target.getTargets"
);
// Ensure expected values specifically for JSON endpoint // and that type is always "page" as main process target should not be included
is(
jsonTarget.type, "page",
`Target (${jsonTarget.id}) from list has expected type (page)`
);
is(
jsonTarget.webSocketDebuggerUrl,
`ws://${RemoteAgent.debuggerAddress}/devtools/page/${wsTarget.targetId}`,
`Target (${jsonTarget.id}) from list has expected webSocketDebuggerUrl value`
);
}
});
add_task(async function json_new_target({ client }) { const newUrl = "https://example.com";
let getError = await requestJSON("/json/new?" + newUrl, {
status: 405,
json: false,
});
is(
getError, "Using unsafe HTTP verb GET to invoke /json/new. This action supports only PUT verb.", "/json/new fails with 405 when using GET"
);
const windowGlobal = BrowsingContext.get(frames[0].id).currentWindowGlobal;
ok(
windowGlobal.documentURI.spec.startsWith("about:neterror?e=cspBlocked"), "Expected page not be loaded within an iframe"
);
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.