Skip to content

Instantly share code, notes, and snippets.

@evanxd
Created October 24, 2016 10:11
Show Gist options
  • Save evanxd/fc5eb3e33732567957aa0c02baaffc00 to your computer and use it in GitHub Desktop.
Save evanxd/fc5eb3e33732567957aa0c02baaffc00 to your computer and use it in GitHub Desktop.
// Please refer to https://dxr.mozilla.org/mozilla-central/source/browser/base/content/tab-content.js#375-393
onPaintWhenWaitedFor: function(forceNonArticle, event) {
if (!event.clientRects.length) {
return;
}
this.cancelPotentialPendingReadabilityCheck();
var t0 = content.performance.now();
var isProbablyReaderable = ReaderMode.isProbablyReaderable(content.document);
var t1 = content.performance.now();
dump("Call to isProbablyReaderable took " + (t1 - t0) + " milliseconds. \n");
if (isProbablyReaderable) {
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: true });
} else if (forceNonArticle) {
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment