-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#7228: Add support for sidePanel in the MV3 build #7354
Merged
Merged
Changes from 26 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
b4ee5cc
POC 3 baseline
fregante 6d0aa00
First pass
fregante a7d0da1
Second pass
fregante ece78d3
Merge remote-tracking branch 'origin/main' into F/mv3/sidePanel-4
fregante a1631e9
Third pass
fregante 36ad162
Fix tests?
fregante 8ffb7c2
knip
fregante 40287e9
Discard changes to webpack.config.mjs
fregante 18814af
Lint
fregante f66b6a4
Move `openSidePanel` to `sidePanelMigration`
fregante 8994081
MV2 verified
fregante 53ad10d
MV3 verified
fregante b0ce0db
webext-messenger: Fix sidebar API target race condition
fregante 7b31ab0
webext-messenger: drop custom ping responder
fregante 67147a0
Merge remote-tracking branch 'origin/main' into F/mv3/sidePanel-4
fregante 9e01796
Dead code
fregante 58e49f9
Merge remote-tracking branch 'origin/main' into F/mv3/sidePanel-4
fregante a407106
Merge popup into sidePanel
fregante 3f545de
Fix tests
fregante 0b43620
Merge remote-tracking branch 'origin/main' into F/mv3/sidePanel-4
fregante 81eb667
Backport sidebar URL creation with "tabId" to MV2
fregante a76a4e4
wip
fregante a120935
Revert "wip"
fregante 19110b9
Revert "Backport sidebar URL creation with "tabId" to MV2"
fregante cc230e3
Restore MV2 support and reorganize target linking
fregante eacc855
Revert page editor changes
fregante bbf0bd3
Fix tests
fregante 81070ec
Cleanup
fregante ad5fe5c
Add support for frames in `getConnectedTarget`
fregante 8d3a8fa
Merge branch 'main' into F/mv3/sidePanel-4
fregante 832bdc3
Extract ternary from SidebarBody
fregante 01c88ef
s/sidePanelClosureSignal/sidePanelOnClose/
fregante 95992ee
Merge remote-tracking branch 'origin/main' into F/mv3/sidePanel-4
fregante b36d35d
Lint
fregante 4a5f655
Restore "Looking for the Extension Console?"
fregante 20cd48d
Merge remote-tracking branch 'origin/main' into F/mv3/sidePanel-4
fregante d24f778
Snapshot update
fregante File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (C) 2023 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { openSidePanel } from "@/mv3/sidePanelMigration"; | ||
import type { MessengerMeta } from "webext-messenger"; | ||
import { isMV3 } from "@/mv3/api"; | ||
import { getSidebarPath } from "@/sidebar/sidePanel/messenger/api"; | ||
|
||
export async function showMySidePanel(this: MessengerMeta): Promise<void> { | ||
await openSidePanel(this.trace[0].tab.id); | ||
} | ||
|
||
// TODO: Drop if this is ever implemented: https://github.com/w3c/webextensions/issues/515 | ||
export async function initSidePanel(): Promise<void> { | ||
if (!isMV3()) { | ||
return; | ||
} | ||
|
||
// TODO: Drop this once the popover URL behavior is merged into sidebar.html | ||
// https://github.com/pixiebrix/pixiebrix-extension/issues/7364 | ||
chrome.tabs.onCreated.addListener(({ id: tabId }) => { | ||
if (tabId) { | ||
void chrome.sidePanel.setOptions({ | ||
tabId, | ||
path: getSidebarPath(tabId), | ||
}); | ||
} | ||
}); | ||
|
||
// We need to target _all_ tabs, not just those we have access to | ||
const existingTabs = await chrome.tabs.query({}); | ||
await Promise.all( | ||
existingTabs.map(async ({ id: tabId, url }) => | ||
chrome.sidePanel.setOptions({ | ||
tabId, | ||
path: getSidebarPath(tabId), | ||
enabled: true, | ||
}), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to double-check:
updateSidebar
equivalent torehydrateSidebar
updateSidebar
equivalent to the optional part ofshowSidebar
?