54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||
|
|
||
|
import random from "../random/random.ts";
|
||
|
import files from "./files.ts";
|
||
|
|
||
|
export default class uri {
|
||
|
static problematic() {
|
||
|
return random.item([
|
||
|
"aim:yaz", // Often triggers an 'external protocol request' dialog
|
||
|
"foop:yaz", // Often triggers an unknown protocol
|
||
|
"about:memory", // Content is not allowed to link or load
|
||
|
"ws://localhost/" // WebSocket protocol
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
static standard() {
|
||
|
return random.item([
|
||
|
"about:blank",
|
||
|
"about:srcdoc",
|
||
|
"about:mozilla",
|
||
|
"about:rights",
|
||
|
"data:text/html,",
|
||
|
"data:image/png,",
|
||
|
"data:",
|
||
|
"javascript:5555",
|
||
|
`javascript:"QQQQ${String.fromCharCode(0)}UUUU"`,
|
||
|
"http://a.invalid/",
|
||
|
"http://localhost:6/",
|
||
|
"https://localhost:6/",
|
||
|
"ftp://localhost:6/",
|
||
|
"http://localhost:25/"
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
static namespace() {
|
||
|
return random.item([
|
||
|
"http://www.w3.org/1999/xhtml",
|
||
|
"http://www.w3.org/2000/svg",
|
||
|
"http://www.w3.org/1998/Math/MathML"
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
static any() {
|
||
|
return random.choose([
|
||
|
[1, uri.problematic],
|
||
|
[10, uri.standard],
|
||
|
[10, uri.namespace],
|
||
|
[10, files.any]
|
||
|
]);
|
||
|
}
|
||
|
}
|