aboutsummaryrefslogtreecommitdiff
path: root/src/content/console-frames.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-12-08 10:48:25 +0900
committerGitHub <noreply@github.com>2018-12-08 10:48:25 +0900
commit9c34b961c68588d95cc942465dae55388e861ffa (patch)
tree697d1cf6ac625aacc4d3685ee37b7a051257f9ec /src/content/console-frames.js
parent97787c773f0d1b5e80beb438246b5a693dbd08aa (diff)
parent80de2149ad592c97158f1adb72b352dab3e0858e (diff)
Merge pull request #507 from ueokande/window-postmessage
Window postmessage
Diffstat (limited to 'src/content/console-frames.js')
-rw-r--r--src/content/console-frames.js27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/content/console-frames.js b/src/content/console-frames.js
index 0c0ec02..401765c 100644
--- a/src/content/console-frames.js
+++ b/src/content/console-frames.js
@@ -16,22 +16,23 @@ const blur = (doc) => {
iframe.blur();
};
-const postMessage = (doc, message) => {
- let iframe = doc.getElementById('vimvixen-console-frame');
- iframe.contentWindow.postMessage(JSON.stringify(message), '*');
-};
-
-const postError = (doc, message) => {
- return postMessage(doc, {
- type: messages.CONSOLE_SHOW_ERROR,
- text: message,
+const postError = (text) => {
+ browser.runtime.sendMessage({
+ type: messages.CONSOLE_FRAME_MESSAGE,
+ message: {
+ type: messages.CONSOLE_SHOW_ERROR,
+ text,
+ },
});
};
-const postInfo = (doc, message) => {
- return postMessage(doc, {
- type: messages.CONSOLE_SHOW_INFO,
- text: message,
+const postInfo = (text) => {
+ browser.runtime.sendMessage({
+ type: messages.CONSOLE_FRAME_MESSAGE,
+ message: {
+ type: messages.CONSOLE_SHOW_INFO,
+ text,
+ },
});
};