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

Bug 1156287 - Do not extract unreachable code after return #5951

Merged
merged 1 commit into from
Apr 20, 2015

Conversation

arai-a
Copy link
Contributor

@arai-a arai-a commented Apr 20, 2015

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

I'm going to add warning for unreachable code after return statement in https://bugzilla.mozilla.org/show_bug.cgi?id=1151931 , and it hits following code.

http://mxr.mozilla.org/mozilla-central/source/browser/extensions/pdfjs/content/web/viewer.js#6818

  PDFViewerApplication.setTitleUsingUrl(file);
  PDFViewerApplication.initPassiveLoading();
  return;


  if (file) {
    PDFViewerApplication.open(file, 0);
  }
}

Those are extracted from following code in upstream.

https://github.com/mozilla/pdf.js/blob/master/web/viewer.js#L1661

//#if (FIREFOX || MOZCENTRAL)
//PDFViewerApplication.setTitleUsingUrl(file);
//PDFViewerApplication.initPassiveLoading();
//return;
//#endif

https://github.com/mozilla/pdf.js/blob/master/web/viewer.js#L1689

//#if !B2G && !CHROME
  if (file) {
    PDFViewerApplication.open(file, 0);
  }
//#endif

if former code is extracted, latter one won't be reachable, so it shouldn't be extracted if (FIREFOX || MOZCENTRAL) is true.

@@ -1686,7 +1686,7 @@ function webViewerInitialized() {
}
//#endif

//#if !B2G && !CHROME
//#if !(FIREFOX || MOZCENTRAL) && !B2G && !CHROME
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this preprocessor line is identical to GENERIC, why not just move this code:

if (file) {
  PDFViewerApplication.open(file, 0);
}

to after line 1686 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for letting me know that, added the patch for it :)

@Snuffleupagus
Copy link
Collaborator

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/5b85c9b53aa4703/output.txt

Snuffleupagus added a commit that referenced this pull request Apr 20, 2015
Bug 1156287 - Do not extract unreachable code after return
@Snuffleupagus Snuffleupagus merged commit c47d60f into mozilla:master Apr 20, 2015
@Snuffleupagus
Copy link
Collaborator

Thank you for the patch!

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.

3 participants