MCPcopy
hub / github.com/google/tamperchrome / checkForApp

Function checkForApp

v1/extension/tamper.js:56–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54// since the app is a rudimentary webserver on port 34013, we check if it's
55// running by sending it a "hello" request and verifying the response
56function checkForApp() {
57 if (appDetected) {
58 appFound();
59 }
60 var xmp = new XMLHttpRequest();
61 var timeout;
62 xmp.open("GET", appUrl + "/hello", true);
63 xmp.onreadystatechange = function() {
64 if (xmp.readyState == 4) {
65 clearTimeout(timeout);
66 if (xmp.responseText != 'Hello') {
67 appNotFound();
68 } else {
69 appFound();
70 }
71 }
72 };
73 timeout = setTimeout(appNotFound, 100);
74 xmp.send();
75}
76
77function askUser(type, data, aux) {
78 var identifier = Date.now().toString() + Math.random().toString().substr(2);

Callers 1

tamper.jsFile · 0.85

Calls 2

appFoundFunction · 0.85
appNotFoundFunction · 0.85

Tested by

no test coverage detected