Skip to content

Commit

Permalink
fix: Fix log window focus
Browse files Browse the repository at this point in the history
Without a popup, we can just directly open the window from the
background script.  In this context, we have permission to focus a
window.

Fixes #23

Change-Id: I572c71fb65a9b5ac71e9d6afd1d04cefbe650eed
  • Loading branch information
joeyparrish committed Nov 12, 2021
1 parent 86c72c0 commit 8d09fea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 58 deletions.
18 changes: 12 additions & 6 deletions log-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,15 @@ function prettyPrint(obj, indentation = '') {
* Listens for messages from the content script to append a log item to the
* current frame and log file.
*/
if (chrome.runtime) {
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
const log = request.log;
EmeLogWindow.instance.appendLog(log);
});
}
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
const log = request.log;
EmeLogWindow.instance.appendLog(log);
});

/**
* When the extension icon is clicked, open the log window if it doesn't exist,
* and bring it to the front otherwise.
*/
chrome.browserAction.onClicked.addListener((tab) => {
EmeLogWindow.instance.open();
});
1 change: 1 addition & 0 deletions log.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
-->
<html>
<head>
<title>EME Logger</title>
<script src="log.js"></script>
<style>
#clear-button {
Expand Down
3 changes: 1 addition & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"scripts": ["log-window.js"]
},
"browser_action": {
"default_title": "EME Logger",
"default_popup": "popup.html"
"default_title": "EME Logger"
},
"web_accessible_resources": [
"trace-anything.js",
Expand Down
20 changes: 0 additions & 20 deletions popup.html

This file was deleted.

30 changes: 0 additions & 30 deletions popup.js

This file was deleted.

0 comments on commit 8d09fea

Please sign in to comment.