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 pdf viewer support for e10s (Bug 942707). #5115

Merged
merged 4 commits into from
Sep 17, 2014

Conversation

yurydelendik
Copy link
Contributor

@timvandermeij timvandermeij added this to the 2014 Q3 milestone Aug 1, 2014
let PdfjsChromeUtils = {
// For security purposes when running remote, we restrict preferences
// content can access.
_allowedPrefNames: [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hard-coding the preference names here seems unfortunate to me, since it unnecessarily increases the maintenance burden; and it's easy for this file and web/default_preferences.js to get out of sync.

I would instead suggest using the preprocessor to include DEFAULT_PREFERENCES in this file, and then compare against those in the code below; for reference see either bootstrap.js#L54 or PdfJs.jsm#63.

@yurydelendik
Copy link
Contributor Author

@jmathies I was able to run it as an extension, however find functionality does not work. Can you look you that.

Also, I was not able to run firefox pdf viewer that was build based on the https://bugzilla.mozilla.org/show_bug.cgi?id=942707 patches (just to verify if find works there). Looks like it is not hooked properly.

@jmathies
Copy link
Contributor

jmathies commented Aug 7, 2014

Sure, I’m on pto till Monday though, will look at it when I’m back.

Jim

From: Yury Delendik [mailto:[email protected]]
Sent: Wednesday, August 06, 2014 6:15 PM
To: mozilla/pdf.js
Cc: Jim Mathies
Subject: Re: [pdf.js] Firefox pdf viewer support for e10s (Bug 942707). (#5115)

@jmathies https://github.com/jmathies I was able to run it as an extension, however find functionality does not work. Can you look you that.

Also, I was not able to run firefox pdf viewer that was build based on the https://bugzilla.mozilla.org/show_bug.cgi?id=942707 patches (just to verify if find works there). Looks like it is not hooked properly.


Reply to this email directly or view it on GitHub #5115 (comment) .Image removed by sender.

@yurydelendik
Copy link
Contributor Author

updated with new set of patches from @jmathies -- looks like extension works now for e10s

/botio-windows preview

@pdfjsbot
Copy link

pdfjsbot commented Sep 6, 2014

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/cf58ca7c5a891ed/output.txt

@yurydelendik yurydelendik force-pushed the e10s branch 2 times, most recently from dceadf0 to aaafcc6 Compare September 8, 2014 20:29
@yurydelendik yurydelendik force-pushed the e10s branch 2 times, most recently from d71d796 to 0199d16 Compare September 8, 2014 20:45
@yurydelendik
Copy link
Contributor Author

/botio-windows preview

@pdfjsbot
Copy link

pdfjsbot commented Sep 8, 2014

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/3d9639a941d1cca/output.txt

* note, the pref names here are cross-checked against a list of
* approved pdfjs prefs in chrome utils. If you add additional pdfjs
* prefs update the defaults in DEFAULT_PREFERENCES and in chrome
* utils _allowedPrefNames.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The last sentence is no longer applicable.

@jmathies
Copy link
Contributor

jmathies commented Sep 9, 2014

Full output at http://107.22.172.223:8877/3d9639a941d1cca/output.txt

Total script time: 0.96 mins
Published

Viewer: http://107.22.172.223:8877/3d9639a941d1cca/web/viewer.html
B2G Viewer: http://107.22.172.223:8877/3d9639a941d1cca/extensions/b2g/content/web/viewer.html
Extension: http://107.22.172.223:8877/3d9639a941d1cca/extensions/firefox/pdf.js.xpi
Extension (AMO): http://107.22.172.223:8877/3d9639a941d1cca/extensions/firefox/pdf.js.amo.xpi

This extension is working for me. tested basic functionality, everything seems ok.

@yurydelendik
Copy link
Contributor Author

This extension is working for me. tested basic functionality, everything seems ok.

Thank you for testing. One question is left: does my code properly cleans itself out when the extension is disabled/restarted/reinstalled/removed?

@Snuffleupagus
Copy link
Collaborator

I think you need to add a line like:

cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfjsChromeUtils.jsm');

for node make firefox/mozcentral in https://github.com/mozilla/pdf.js/blob/master/make.js to avoid a file header in the middle of the code.

@jmathies
Copy link
Contributor

jmathies commented Sep 9, 2014

I tested install/uninstall. Uninstall required a restart to get the extension unloaded, but once I reboot the built-in rev came back.

From: Yury Delendik [mailto:[email protected]]
Sent: Tuesday, September 09, 2014 9:23 AM
To: mozilla/pdf.js
Cc: Jim Mathies
Subject: Re: [pdf.js] Firefox pdf viewer support for e10s (Bug 942707). (#5115)

This extension is working for me. tested basic functionality, everything seems ok.

Thank you for testing. One question is left: does my code properly cleans itself out when the extension is disabled/restarted/reinstalled/removed?


Reply to this email directly or view it on GitHub #5115 (comment) .Image removed by sender.

// Load the component and register it.
pdfStreamConverterUrl = aData.resourceURI.spec +
'content/PdfStreamConverter.jsm';
var pdfStreamConverterUrl = pdfBaseUrl + 'content/PdfStreamConverter.jsm';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we registering the stream converter here and in content.js for e10s?

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 how I understand: content for e10s content window, and browser for non-e10s window.

See browser/extensions/pdfjs/content/pdfjschildbootstrap.js

if (e10sEnabled) {
let globalMM = Cc['@mozilla.org/globalmessagemanager;1']
.getService(Ci.nsIMessageListenerManager);
globalMM.sendSyncMessage('PDFJS:Child:shutdown');
Copy link
Contributor

Choose a reason for hiding this comment

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

Disabling the addon:
Exception running bootstrap method shutdown on [email protected]: TypeError: globalMM.sendSyncMessage is not a function (resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/bdahl/Library/Application%20Support/Firefox/Profiles/dx3hp1j0.e10s/extensions/[email protected]!/bootstrap.js:182:4) JS Stack trace: shutdown@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/bdahl/Library/Application%20Support/Firefox/Profiles/dx3hp1j0.e10s/extensions/[email protected]:182:5 < [email protected]:4304:9 < [email protected]:4418:1 < [email protected]:6741:9 < [email protected]:1084:11 < oncommand@about:addons:1:1

// Load the component and register it.
pdfStreamConverterUrl = aData.resourceURI.spec +
'content/PdfStreamConverter.jsm';
var pdfStreamConverterUrl = pdfBaseUrl + 'content/PdfStreamConverter.jsm';
Cu.import(pdfStreamConverterUrl);
pdfStreamConverterFactory.register(PdfStreamConverter);
Copy link
Contributor

Choose a reason for hiding this comment

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

During disable:
WARN Exception running bootstrap method startup on [email protected]: [Exception... "Component returned failure code: 0xc1f30100 (NS_ERROR_FACTORY_EXISTS) [nsIComponentRegistrar.registerFactory]" nsresult: "0xc1f30100 (NS_ERROR_FACTORY_EXISTS)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/bdahl/Library/Application%20Support/Firefox/Profiles/dx3hp1j0.e10s/extensions/[email protected]!/bootstrap.js :: register :: line 99" data: no] Stack trace: register()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/bdahl/Library/Application%20Support/Firefox/Profiles/dx3hp1j0.e10s/extensions/[email protected]!/bootstrap.js:99 < startup()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/bdahl/Library/Application%20Support/Firefox/Profiles/dx3hp1j0.e10s/extensions/[email protected]!/bootstrap.js:152 < XPI_callBootstrapMethod()@resource://gre/modules/addons/XPIProvider.jsm:4304 < XPI_updateAddonDisabledState()@resource://gre/modules/addons/XPIProvider.jsm:4427 < AddonWrapper_userDisabledSetter()@resource://gre/modules/addons/XPIProvider.jsm:6741 < set_userDisabled()@extensions.xml:1084 < oncommand()@about:addons:1 < file:unknown

@yurydelendik yurydelendik force-pushed the e10s branch 2 times, most recently from 0257c7c to 7faa801 Compare September 16, 2014 22:59
@yurydelendik
Copy link
Contributor Author

/botio-windows preview

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/56f027959876b4b/output.txt

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.

6 participants