Flatten threads: fix feature in Firefox

The feature didn't work in Firefox because we referenced chrome, which
doesn't exist in the main world in Firefox. This CL fixes this issue.

Change-Id: I5cc3363205fb0e60d3b595394025ff123feb6c96
diff --git a/src/common/actionApi.js b/src/common/actionApi.js
index 69c68b8..0cf8528 100644
--- a/src/common/actionApi.js
+++ b/src/common/actionApi.js
@@ -1,5 +1,5 @@
 // #!if browser_target == 'chromium_mv3'
-export default chrome.action;
+export default typeof chrome !== 'undefined' ? chrome.action : undefined;
 // #!else
-export default chrome.browserAction;
+export default typeof chrome !== 'undefined' ? chrome.browserAction : undefined;
 // #!endif