Skip to content

Commit f07e3ba

Browse files
committed
msglist [nfc]: Pull baseUrl up to module toplevel
This is just as constant as webviewAssetsUrl and assetsUrl; and the only thing we do with either of those is use them in computing this. So move its definition up next to theirs, at the module toplevel.
1 parent 2aeb11e commit f07e3ba

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/webview/MessageList.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ const assetsUrl =
109109
*/
110110
const webviewAssetsUrl = new URL('webview/', assetsUrl);
111111

112+
/**
113+
* Effective URL of the MessageList webview.
114+
*
115+
* It points to `index.html` in the webview-assets folder, which
116+
* doesn't exist.
117+
*
118+
* It doesn't need to exist because we provide all HTML at
119+
* creation (or refresh) time. This serves only as a placeholder,
120+
* so that relative URLs (e.g., to `base.css`, which does exist)
121+
* and cross-domain security restrictions have somewhere to
122+
* believe that this document originates from.
123+
*/
124+
const baseUrl = new URL('index.html', webviewAssetsUrl);
125+
112126
class MessageListInner extends React.Component<Props> {
113127
webviewRef = React.createRef<React$ElementRef<typeof WebView>>();
114128
sendInboundEventsIsReady: boolean;
@@ -182,20 +196,6 @@ class MessageListInner extends React.Component<Props> {
182196
backgroundData.serverEmojiData,
183197
);
184198

185-
/**
186-
* Effective URL of the MessageList webview.
187-
*
188-
* It points to `index.html` in the webview-assets folder, which
189-
* doesn't exist.
190-
*
191-
* It doesn't need to exist because we provide all HTML at
192-
* creation (or refresh) time. This serves only as a placeholder,
193-
* so that relative URLs (e.g., to `base.css`, which does exist)
194-
* and cross-domain security restrictions have somewhere to
195-
* believe that this document originates from.
196-
*/
197-
const baseUrl = new URL('index.html', webviewAssetsUrl);
198-
199199
// Paranoia^WSecurity: only load `baseUrl`, and only load it once. Any other
200200
// requests should be handed off to the OS, not loaded inside the WebView.
201201
const onShouldStartLoadWithRequest = (() => {

0 commit comments

Comments
 (0)