MCPcopy
hub / github.com/Tampermonkey/tampermonkey / realCheck

Function realCheck

src/background.js:3461–3505  ·  view source on GitHub ↗
(r)

Source from the content-addressed store, hash-verified

3459 };
3460
3461 var realCheck = function(r) {
3462 var details = {
3463 method: 'GET',
3464 retries: _retries,
3465 url: determineSourceURL(r.script, true),
3466 };
3467
3468 running++;
3469 (function() {
3470 var obj = { tabid: tabid, r: r};
3471 var durl = determineSourceURL(obj.r.script)
3472 var cb = function(req) {
3473 running--;
3474 if (req.readyState == 4 && req.status == 200) {
3475 if (V) console.log(durl);
3476
3477 var updateHash = function() {
3478 // call only if local and remove script version do match
3479 if (obj.r.meta) {
3480 if (V || UV) console.log("bg: update hash of script " + r.script.name + " to " + obj.r.meta[cUSOHASH]);
3481 obj.r.script.hash = obj.r.meta[cUSOHASH];
3482 storeScript(obj.r.script.name, obj.r.script, false);
3483 }
3484 };
3485
3486 var ret = ScriptUpdater.srcCmp(req.responseText);
3487 if (ret == eNEWER || r.hash_different) {
3488 found++;
3489 if (callback) callback(true, { name: obj.r.script.name,
3490 url: durl,
3491 code: req.responseText,
3492 newhash: obj.r.meta[cUSOHASH] });
3493 return;
3494 } else if (ret == eEQUAL) {
3495 if (V || UV) console.log("bg: found same version @ " + durl);
3496 updateHash();
3497 }
3498 } else {
3499 console.log(I18N.getMessage("UpdateCheck_of_0name0_Url_0url0_failed_", [ obj.r.script.name, durl ]));
3500 }
3501 checkNoUpdateNotification();
3502 };
3503 xmlhttpRequest(details, cb);
3504 })();
3505 };
3506
3507 var metaCheck = function(r) {
3508 running++;

Callers 1

getmetaFunction · 0.85

Calls 2

determineSourceURLFunction · 0.85
xmlhttpRequestFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…