Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
4e5b18ba
Commit
4e5b18ba
authored
Apr 14, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Apr 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce non-empty configuration when boot script is run from the browser extension
parent
1c07780a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
index.js
src/boot/index.js
+12
-0
No files found.
src/boot/index.js
View file @
4e5b18ba
...
@@ -21,6 +21,18 @@ if (isBrowserSupported()) {
...
@@ -21,6 +21,18 @@ if (isBrowserSupported()) {
const
config
=
/** @type {AnnotatorConfig|SidebarAppConfig} */
(
const
config
=
/** @type {AnnotatorConfig|SidebarAppConfig} */
(
parseJsonConfig
(
document
)
parseJsonConfig
(
document
)
);
);
// When the boot script is executed from the browser extension, at least one
// config is required
const
isExtensionContext
=
!!
(
/** @type {any} */
(
window
).
chrome
?.
runtime
?.
id
);
if
(
!
Object
.
keys
(
config
).
length
&&
isExtensionContext
)
{
throw
new
Error
(
'Could not start Hypothesis extension as configuration is missing'
);
}
const
assetRoot
=
processUrlTemplate
(
config
.
assetRoot
||
'__ASSET_ROOT__'
);
const
assetRoot
=
processUrlTemplate
(
config
.
assetRoot
||
'__ASSET_ROOT__'
);
// Check whether this is the sidebar app (indicated by the presence of a
// Check whether this is the sidebar app (indicated by the presence of a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment