Skip to content
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

[Firefox] Remove the FirefoxCom.requestSync method #17338

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

Snuffleupagus
Copy link
Collaborator

Please refer to the individual commit messages for additional details.

@Snuffleupagus
Copy link
Collaborator Author

I've successfully ran $ ./mach test toolkit/components/pdfjs/ locally with this patch applied.

The return value is not, nor has it ever been, used for anything and we should thus be able to just send the message.
Note that the responses are already handled by the "message" event listener registered above.
Despite the comment, I believe that changing this should be fine for two separate reasons:
 - The platform code has an "unload" event listener, see [this code](https://searchfox.org/mozilla-central/rev/edb2612db13e89f1c44ab95b1e4d4366c16eb9fb/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#533-538), that invokes the same method. Hence we should still be guaranteed that the relevant platform method will run.

 - The `FirefoxComDataRangeTransport.abort` method is never actually invoked in the Firefox PDF Viewer.
   Note that the [`PDFDataRangeTransport.abort` method](https://github.com/mozilla/pdf.js/blob/f4b396f6c88e951174879a52390fa89223326b36/src/display/api.js#L759) is only invoked via the [`PDFDataTransportStream.cancelAllRequests` method](https://github.com/mozilla/pdf.js/blob/f4b396f6c88e951174879a52390fa89223326b36/src/display/transport_stream.js#L167-L175), which in turn is only invoked via the [`WorkerTransport.destroy` method](https://github.com/mozilla/pdf.js/blob/f4b396f6c88e951174879a52390fa89223326b36/src/display/api.js#L2485-L2487). That method is invoked via the [`PDFDocumentLoadingTask.destroy` method](https://github.com/mozilla/pdf.js/blob/f4b396f6c88e951174879a52390fa89223326b36/src/display/api.js#L630), which in the viewer is only invoked via the [`PDFViewerApplication.close` method](https://github.com/mozilla/pdf.js/blob/f4b396f6c88e951174879a52390fa89223326b36/web/app.js#L919) which is never actually called in the Firefox PDF Viewer.

All-in-all, given the existing platform code *and* the current viewer-implementation it should thus be safe to not wait for the "abortLoading" message to complete.
After the two previous commits, which removed the remaining call-sites, this method is no longer used and can thus be removed.
As mentioned in the JSDocs for the now removed method, synchronous communication between the viewer and the platform code isn't really a good idea.

Once this patch has landed in mozilla-central some additional clean-up of the platform code will also be possible.
Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@calixteman calixteman merged commit 59cf2ee into mozilla:master Nov 28, 2023
7 checks passed
@Snuffleupagus Snuffleupagus deleted the rm-FirefoxCom-requestSync branch November 29, 2023 10:17
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 1, 2023
…js-reviewers,calixte

After the changes in mozilla/pdf.js#17338, which landed in bug 1867213, we longer send any synchronous events from the viewer to the platform-code.

Differential Revision: https://phabricator.services.mozilla.com/D195082
aosmond pushed a commit to aosmond/gecko that referenced this pull request Dec 1, 2023
…js-reviewers,calixte

After the changes in mozilla/pdf.js#17338, which landed in bug 1867213, we longer send any synchronous events from the viewer to the platform-code.

Differential Revision: https://phabricator.services.mozilla.com/D195082
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Dec 7, 2023
…js-reviewers,calixte

After the changes in mozilla/pdf.js#17338, which landed in bug 1867213, we longer send any synchronous events from the viewer to the platform-code.

Differential Revision: https://phabricator.services.mozilla.com/D195082

UltraBlame original commit: e4d00d2a30f40c896b99c6ab4f631a5d5f80e30d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Dec 7, 2023
…js-reviewers,calixte

After the changes in mozilla/pdf.js#17338, which landed in bug 1867213, we longer send any synchronous events from the viewer to the platform-code.

Differential Revision: https://phabricator.services.mozilla.com/D195082

UltraBlame original commit: e4d00d2a30f40c896b99c6ab4f631a5d5f80e30d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Dec 7, 2023
…js-reviewers,calixte

After the changes in mozilla/pdf.js#17338, which landed in bug 1867213, we longer send any synchronous events from the viewer to the platform-code.

Differential Revision: https://phabricator.services.mozilla.com/D195082

UltraBlame original commit: e4d00d2a30f40c896b99c6ab4f631a5d5f80e30d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants