mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
remove window.parent check from contentscript
The manifest 'all_frames' property defaults to false, so the contentscript should not need to perform the window.parent check.
This commit is contained in:
@@ -22,15 +22,13 @@ function toggleToolbar(toolbarUI) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle messages from the add-on background page (only in top level iframes)
|
||||
if (window.parent == window) {
|
||||
chrome.runtime.onMessage.addListener(function(msg) {
|
||||
if (msg == "toggle-in-page-toolbar") {
|
||||
if (toolbarUI) {
|
||||
toggleToolbar(toolbarUI);
|
||||
} else {
|
||||
toolbarUI = initToolbar();
|
||||
}
|
||||
// Handle messages from the add-on background page
|
||||
chrome.runtime.onMessage.addListener(function(msg) {
|
||||
if (msg == "toggle-in-page-toolbar") {
|
||||
if (toolbarUI) {
|
||||
toggleToolbar(toolbarUI);
|
||||
} else {
|
||||
toolbarUI = initToolbar();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user