From 24c04005b85e19b5958530e1a4092cbe8c072732 Mon Sep 17 00:00:00 2001 From: yakov116 <16872793+yakov116@users.noreply.github.com> Date: Fri, 16 Oct 2020 15:18:36 -0400 Subject: Restore `embed-gist-inline` feature (#3640) Co-authored-by: Federico --- source/features/embed-gist-inline.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source/features/embed-gist-inline.tsx') diff --git a/source/features/embed-gist-inline.tsx b/source/features/embed-gist-inline.tsx index 711f3610..0bdb0e63 100644 --- a/source/features/embed-gist-inline.tsx +++ b/source/features/embed-gist-inline.tsx @@ -4,7 +4,6 @@ import select from 'select-dom'; import * as pageDetect from 'github-url-detection'; import features from '.'; -import {isFirefox} from '../github-helpers'; const isGist = (link: HTMLAnchorElement): boolean => !link.pathname.includes('.') && // Exclude links to embed files @@ -20,8 +19,8 @@ async function embedGist(link: HTMLAnchorElement): Promise { link.after(info); try { - const response = await fetch(`${link.href}.json`); - const gistData = await response.json(); + // Get the gist via background.js due to CORB policies introduced in Chrome 73 + const gistData = await browser.runtime.sendMessage({request: `${link.href}.json`}); const files = domify.one(gistData.div)!; const fileCount = files.children.length; @@ -60,9 +59,5 @@ void features.add({ include: [ pageDetect.hasComments ], - exclude: [ - // https://github.com/sindresorhus/refined-github/issues/2022 - () => isFirefox - ], init }); -- cgit v1.2.3