Skip to content

Commit

Permalink
fix: async error in firefox, close #786
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Dec 27, 2023
1 parent 363fd89 commit 8ea45ea
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/background/messages/responseDisplayedRules.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { PlasmoMessaging } from "@plasmohq/messaging"
import { setDisplayedRules } from "~/background/rules"

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const handler: PlasmoMessaging.MessageHandler = (req, res) => {
console.debug("response displayed rules", req)

setDisplayedRules(req.body.displayedRules)
Expand Down
2 changes: 1 addition & 1 deletion src/contents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sendToBackground({
name: "contentReady",
})

chrome.runtime.onMessage.addListener(async (msg, sender, sendResponse) => {
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
if (msg.name === "requestHTML") {
sendResponse(document.documentElement.outerHTML)
}
Expand Down
2 changes: 1 addition & 1 deletion src/sandboxes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const getDisplayedRules = (rules: string) => {
}

if (typeof window !== "undefined") {
window.addEventListener("message", async (event: MessageEvent<{
window.addEventListener("message", (event: MessageEvent<{
name: "requestRSS"
body: {
html: string
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/offscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ window.addEventListener('message', (event) => {
function OffscreenPage() {
const iframeRef = useRef<HTMLIFrameElement>(null);

chrome.runtime.onMessage.addListener(async (msg) => {
chrome.runtime.onMessage.addListener((msg) => {
console.debug("Received message from background", msg);
iframeRef.current?.contentWindow?.postMessage(msg.data, "*");
})
Expand Down

0 comments on commit 8ea45ea

Please sign in to comment.