Skip to content

Commit

Permalink
"Add Bad Third-Party During Load" and "Force Boomerang Continuity Bet…
Browse files Browse the repository at this point in the history
…a" options
  • Loading branch information
nicjansma committed Oct 2, 2017
1 parent d4c2b61 commit 5303d32
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions perfbar.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,14 @@ var UW = unsafeWindow;
setState("delayFrameworkHandlers", getState("delayFrameworkHandlers") ? false : true);
}

function toggleAddBadThirdPartyDuringLoad() {
setState("badThirdParty", getState("badThirdParty") ? false : true);
}

function forceBoomerangContinuityBeta() {
setState("forceBoomerangContinuityBeta", getState("forceBoomerangContinuityBeta") ? false : true);
}

function toggleDisableEdgeCache() {
const cookieName = 'AK_FORCE_ORIGIN'
var force = readCookie(cookieName)
Expand Down Expand Up @@ -836,6 +844,12 @@ var UW = unsafeWindow;
events: { click: toggleJank },
selected: jankInterval
},
"addBadThirdPartyDuringLoad": {
name: "Add Bad Third-Party During Load",
type: "checkbox",
events: { click: toggleAddBadThirdPartyDuringLoad },
selected: getState("badThirdParty"),
},
"delayFrameworks": {
name: "Delay Framework Handlers During Load",
type: "checkbox",
Expand All @@ -853,6 +867,12 @@ var UW = unsafeWindow;
type: "checkbox",
events: { click: toggleShowCacheStatus },
selected: getState("cacheStatus"),
},
"forceBoomerangVersion": {
name: "Force Boomerang Continuity Beta",
type: "checkbox",
events: { click: forceBoomerangContinuityBeta },
selected: getState("forceBoomerangContinuityBeta"),
}
},
position: function(opt){
Expand Down Expand Up @@ -1004,6 +1024,40 @@ var UW = unsafeWindow;
ael.call(_this, eventName, rage);
}
}

function loadIframe(src) {
var iframe = document.createElement("iframe");
iframe.id = "bad-third-party";
iframe.src = src;
(iframe.frameElement || iframe).style.cssText = "width:0;height:0;border:0;display:none;";
var where = document.getElementsByTagName("head")[0];
where.parentNode.insertBefore(iframe, where);

return iframe;
}

//
// Add Bad Third-Party During Load
//
if (getState("badThirdParty")) {
var thirdPartyFrame = loadIframe("https://nicj.net/dev/bad-third-party.html");
if (document.readyState === "complete") {
thirdPartyFrame.contentWindow.postMessage("busy", "*")
} else {
window.addEventListener("load", function() {
setTimeout(function() {
thirdPartyFrame.contentWindow.postMessage("busy", "*");
}, 10);
}, false);
};
}

//
// Force the Boomerang Continuity Beta
//
if (getState("forceBoomerangContinuityBeta")) {
loadIframe("https://c.go-mpulse.net/boomerang/boomerang-debug.html?version=1.10038.0")
}
})();

//
Expand Down

0 comments on commit 5303d32

Please sign in to comment.