0
votes

I am working on a firefox extension that gets the html content from the current tab in the browser. Majority of the processing takes place in popup.js file which is embedded in the popup UI that is displayed on clicking the toolbar icon for the extension. Due to this, the performance of the extension suffers and occasionally I see a spinning wheel while capturing. Is there a way I could move this processing to the background? I am loading a script using the loadFrameScript api when the capture button is clicked.

Is there any such thing as background page in Firefox extensions like in chrome and Safari? If no, please suggest a way to optimize this.

1
What sort of processing is done? You say you take the entire HTML content, possibly you're grabbing too much? Usually only a small subset of that content is actually needed. - Ashley Strout
Yes, I am grabbing the entire html content and parsing the data and removing stuff that I don't need. - Vivek
Again, I don't know what you're doing, but is it possible that rather than grabbing everything, you can use functions like getElementsByTagName? - Ashley Strout
@David I have to capture the entire html page as is with style and everything, so getElementsByTagName is not an option. :( - Vivek
I'm just making up options here. It's up to you to determine the adequate way (if any) to limit the data necessary to process. getElementsByTagName was just one option, there are others. I can better advise you if I know what you're doing with the captured HTML. - Ashley Strout

1 Answers

0
votes

Use a Web Worker, if there is some reason why you can't then can you explain that?