@@ -544,21 +544,6 @@ PdfStreamConverter.prototype = {
544
544
if (!isEnabled ())
545
545
throw Cr .NS_ERROR_NOT_IMPLEMENTED ;
546
546
547
- var useFetchByChrome = getBoolPref (PREF_PREFIX + '.fetchByChrome' , true );
548
- if (!useFetchByChrome ) {
549
- // Ignoring HTTP POST requests -- pdf.js has to repeat the request.
550
- var skipConversion = false ;
551
- try {
552
- var request = aCtxt ;
553
- request .QueryInterface (Ci .nsIHttpChannel );
554
- skipConversion = (request .requestMethod !== 'GET' );
555
- } catch (e ) {
556
- // Non-HTTP request... continue normally.
557
- }
558
- if (skipConversion )
559
- throw Cr .NS_ERROR_NOT_IMPLEMENTED ;
560
- }
561
-
562
547
// Store the listener passed to us
563
548
this .listener = aListener ;
564
549
},
@@ -577,22 +562,15 @@ PdfStreamConverter.prototype = {
577
562
578
563
// nsIRequestObserver::onStartRequest
579
564
onStartRequest : function (aRequest , aContext ) {
580
-
581
565
// Setup the request so we can use it below.
582
566
aRequest .QueryInterface (Ci .nsIChannel );
583
- var useFetchByChrome = getBoolPref (PREF_PREFIX + '.fetchByChrome' , true );
584
- var dataListener ;
585
- if (useFetchByChrome ) {
586
- // Creating storage for PDF data
587
- var contentLength = aRequest .contentLength ;
588
- dataListener = new PdfDataListener (contentLength );
589
- this .dataListener = dataListener ;
590
- this .binaryStream = Cc ['@mozilla.org/binaryinputstream;1' ]
591
- .createInstance (Ci .nsIBinaryInputStream );
592
- } else {
593
- // Cancel the request so the viewer can handle it.
594
- aRequest .cancel (Cr .NS_BINDING_ABORTED );
595
- }
567
+ // Creating storage for PDF data
568
+ var contentLength = aRequest .contentLength ;
569
+ var dataListener = new PdfDataListener (contentLength );
570
+ this .dataListener = dataListener ;
571
+ this .binaryStream = Cc ['@mozilla.org/binaryinputstream;1' ]
572
+ .createInstance (Ci .nsIBinaryInputStream );
573
+
596
574
// Change the content type so we don't get stuck in a loop.
597
575
aRequest .contentType = 'text/html' ;
598
576
@@ -642,19 +620,17 @@ PdfStreamConverter.prototype = {
642
620
channel .originalURI = aRequest .URI ;
643
621
channel .loadGroup = aRequest .loadGroup ;
644
622
645
- if (useFetchByChrome ) {
646
- // We can use resource principal when data is fetched by the chrome
647
- // e.g. useful for NoScript
648
- var securityManager = Cc ['@mozilla.org/scriptsecuritymanager;1' ]
649
- .getService (Ci .nsIScriptSecurityManager );
650
- var uri = ioService .newURI (PDF_VIEWER_WEB_PAGE , null , null );
651
- // FF16 and below had getCodebasePrincipal, it was replaced by
652
- // getNoAppCodebasePrincipal (bug 758258).
653
- var resourcePrincipal = 'getNoAppCodebasePrincipal' in securityManager ?
654
- securityManager .getNoAppCodebasePrincipal (uri ) :
655
- securityManager .getCodebasePrincipal (uri );
656
- aRequest .owner = resourcePrincipal ;
657
- }
623
+ // We can use resource principal when data is fetched by the chrome
624
+ // e.g. useful for NoScript
625
+ var securityManager = Cc ['@mozilla.org/scriptsecuritymanager;1' ]
626
+ .getService (Ci .nsIScriptSecurityManager );
627
+ var uri = ioService .newURI (PDF_VIEWER_WEB_PAGE , null , null );
628
+ // FF16 and below had getCodebasePrincipal, it was replaced by
629
+ // getNoAppCodebasePrincipal (bug 758258).
630
+ var resourcePrincipal = 'getNoAppCodebasePrincipal' in securityManager ?
631
+ securityManager .getNoAppCodebasePrincipal (uri ) :
632
+ securityManager .getCodebasePrincipal (uri );
633
+ aRequest .owner = resourcePrincipal ;
658
634
channel .asyncOpen (proxy , aContext );
659
635
},
660
636
0 commit comments