Skip to content

Commit

Permalink
[loading] enforce javascript execution starting
Browse files Browse the repository at this point in the history
  • Loading branch information
nxmatic committed Jul 12, 2024
1 parent 030d103 commit ca9ecbb
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/popup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ Please open the JavaScript console of the <a href="chrome://extensions/">nuxeo w
$('#reset').css('top', 5);
};

// reset jQuery event handlers
$('body').find('*').addBack().off();

worker.connectLocator
.asRegistration()
.then((input) => {
Expand All @@ -234,10 +237,6 @@ Please open the JavaScript console of the <a href="chrome://extensions/">nuxeo w
const connectCredentials = credentials;
return { connectUrl, connectCredentials, ...input };
})
// wait for the document to be ready
.then((input) => new Promise((resolve) => {
$(document).ready(() => resolve(input));
}))
// remove the studio package name input if the feature flag is not set
.then((input) => worker.developmentMode
.isFeatureFlagSet('studio-package-name')
Expand All @@ -251,8 +250,6 @@ Please open the JavaScript console of the <a href="chrome://extensions/">nuxeo w
// eslint-disable-next-line no-unused-vars
.then(({ connectUrl, connectCredentials, cookiesGranted }) => {
const pendingPromises = [];
// reset jQuery event handlers
$('body').find('*').addBack().off();
$('#connect-url-input').val(connectUrl);

// Grant cookies permissions to connect if needed
Expand Down Expand Up @@ -991,6 +988,8 @@ Please open the JavaScript console of the <a href="chrome://extensions/">nuxeo w
.catch((cause) => stopLoading(cause));
}

new ServiceWorkerBridge()
.bootstrap({ name: 'reloadPopup', entrypoint: loadPage })
.catch((error) => console.error(error));
document.addEventListener('DOMContentLoaded', () => {
const worker = new ServiceWorkerBridge();
worker.bootstrap({ name: 'popup', entrypoint: loadPage })
.catch((error) => console.error(error));
});

0 comments on commit ca9ecbb

Please sign in to comment.