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

Split pdfjschildbootstrap.js to avoid sync IPC #8218

Merged
merged 2 commits into from
Apr 3, 2017

Conversation

amccreight
Copy link
Contributor

See the commit messages for a more detailed explanation.

In terms of local testing, I only ran the linter but it doesn't seem like this should really affect the addon.


if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
// register various pdfjs factories that hook us into content loading.
PdfJs.ensureRegistration();
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean ensureRegistered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! I guess I should test it a little more.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can run gulp firefox to build the Firefox extension XPI locally, which should help with testing this.

@@ -173,7 +173,7 @@ var PdfJs = {

updateRegistration: function updateRegistration() {
if (this.enabled) {
this._ensureRegistered();
this.ensureRegistered();
Copy link
Contributor

@timvandermeij timvandermeij Mar 30, 2017

Choose a reason for hiding this comment

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

If this one is public, i.e., has no underscore, then I think it would be good to make _ensureUnregistered public as well, so remove the underscore there as well for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds reasonable. I just left it private because I didn't actually need it, but it is a little weird to make it different.

@@ -0,0 +1,31 @@
/* Copyright 2014 Mozilla Foundation
Copy link
Contributor

@timvandermeij timvandermeij Mar 30, 2017

Choose a reason for hiding this comment

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

How is this new file used at the moment? I don't see an include of it anywhere. Do you perhaps need to include it in build process like

gulp.src(FIREFOX_CONTENT_DIR + 'pdfjschildbootstrap.js')
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, like the pdfjschildbootstrap.js file, I think isn't actually used by the extension. It is a script called directly by Firefox code, in browser/components/nsBrowserGlue.js. But yeah I guess I need to do whatever packaging thing this is doing. Maybe that's how the in-tree version in Firefox gets updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is difference in few files for firefox extension and mozilla-central. That includes PdfJsTelemetry.jsm and PdfJs.jsm files -- notice that extension "disables" embedded version of pdf.js by adding PdfJs-stub.

mozilla-central is using pdfjschildbootstrap.js+PdfJs.jsm, but firefox extension only bootstrap.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's good to know. I have some other changes I want to make to avoid loading .jsms when no PDF has been loaded, and it looks like that will help me.

@timvandermeij
Copy link
Contributor

Could you perhaps squash the commits into one commit (see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits)?

@timvandermeij
Copy link
Contributor

/botio-linux preview

pdfjschildbootstrap.js will always be run, but
pdfjschildbootstrap-enabled.js will only be run if PdfJs.enabled is
true. This will let us avoid some work in the child process in the
next patch.

This will need to be landed in the mozilla-central repository at the
same time as a change to nsBrowserGlue.js. See bug 1352218.
If we only invoke the bootstrap-enabled script when PdfJs.enabled is
true, then we don't need to check it again in the script.

This avoids a sync IPC call to the parent process.

It also keeps PdfJs.jsm from importing PdfjsContentUtils.jsm in the
child process until it is actually needed, which is one steps towards
not loading it until it is really needed.
@amccreight
Copy link
Contributor Author

I folded the fixes into the original two patches. Is that enough, or do you really just want it in one commit? (Each patch should be a separate logical change.)

@timvandermeij
Copy link
Contributor

timvandermeij commented Mar 31, 2017

I'm fine with having two logically separate commits for this. Thanks!

I'll create a new preview for this so we have an XPI file for testing.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/d88eb0e9ed0951e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/d88eb0e9ed0951e/output.txt

Total script time: 2.72 mins

Published

@yurydelendik yurydelendik merged commit a2ddf2f into mozilla:master Apr 3, 2017
@yurydelendik
Copy link
Contributor

https://bugzilla.mozilla.org/show_bug.cgi?id=1352218

Thank you for the patch.

@amccreight
Copy link
Contributor Author

Thanks for all of the help with my patch.

@amccreight amccreight deleted the no-sync branch April 3, 2017 22:45
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Apr 8, 2017
One is always run, the other is only run when PdfJs.enabled is true in
the parent process. This refactoring enables the next patch.

The extensions changes are from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: HwQ3yk8Jck4

--HG--
extra : rebase_source : 94f1516989685176a95e235f2d3ef8658adaf8b7
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Apr 8, 2017
This avoids a sync IPC message from child to parent.

Changes entirely from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: 3Egayok3DBZ

--HG--
extra : rebase_source : e02829e2508bb75caf44c0a3c86b06fac3bf167f
Manishearth pushed a commit to Manishearth/gecko-dev that referenced this pull request Apr 11, 2017
One is always run, the other is only run when PdfJs.enabled is true in
the parent process. This refactoring enables the next patch.

The extensions changes are from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: HwQ3yk8Jck4
Manishearth pushed a commit to Manishearth/gecko-dev that referenced this pull request Apr 11, 2017
This avoids a sync IPC message from child to parent.

Changes entirely from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: 3Egayok3DBZ
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this pull request Apr 12, 2017
One is always run, the other is only run when PdfJs.enabled is true in
the parent process. This refactoring enables the next patch.

The extensions changes are from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: HwQ3yk8Jck4
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this pull request Apr 12, 2017
This avoids a sync IPC message from child to parent.

Changes entirely from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: 3Egayok3DBZ
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Split pdfjschildbootstrap.js to avoid sync IPC
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
One is always run, the other is only run when PdfJs.enabled is true in
the parent process. This refactoring enables the next patch.

The extensions changes are from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: HwQ3yk8Jck4

UltraBlame original commit: 20def3cc99f49c2682bc69c53f7cac57bdfb7596
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
This avoids a sync IPC message from child to parent.

Changes entirely from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: 3Egayok3DBZ

UltraBlame original commit: 752d857f85cd9374ea28c309b74585c2548a2d7a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
One is always run, the other is only run when PdfJs.enabled is true in
the parent process. This refactoring enables the next patch.

The extensions changes are from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: HwQ3yk8Jck4

UltraBlame original commit: 20def3cc99f49c2682bc69c53f7cac57bdfb7596
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
This avoids a sync IPC message from child to parent.

Changes entirely from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: 3Egayok3DBZ

UltraBlame original commit: 752d857f85cd9374ea28c309b74585c2548a2d7a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
One is always run, the other is only run when PdfJs.enabled is true in
the parent process. This refactoring enables the next patch.

The extensions changes are from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: HwQ3yk8Jck4

UltraBlame original commit: 20def3cc99f49c2682bc69c53f7cac57bdfb7596
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
This avoids a sync IPC message from child to parent.

Changes entirely from:
  mozilla/pdf.js#8218

MozReview-Commit-ID: 3Egayok3DBZ

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

Successfully merging this pull request may close these issues.

4 participants