@@ -2024,6 +2024,7 @@ def _set_firefox_options(
2024
2024
disable_csp ,
2025
2025
firefox_arg ,
2026
2026
firefox_pref ,
2027
+ external_pdf ,
2027
2028
):
2028
2029
blank_p = "about:blank"
2029
2030
options = webdriver .FirefoxOptions ()
@@ -2035,7 +2036,6 @@ def _set_firefox_options(
2035
2036
options .set_preference ("browser.newtab.url" , blank_p )
2036
2037
options .set_preference ("trailhead.firstrun.branches" , "nofirstrun-empty" )
2037
2038
options .set_preference ("browser.aboutwelcome.enabled" , False )
2038
- options .set_preference ("pdfjs.disabled" , True )
2039
2039
options .set_preference ("app.update.auto" , False )
2040
2040
options .set_preference ("app.update.enabled" , False )
2041
2041
options .set_preference ("browser.formfill.enable" , False )
@@ -2122,13 +2122,20 @@ def _set_firefox_options(
2122
2122
options .set_preference (
2123
2123
"browser.helperApps.neverAsk.saveToDisk" ,
2124
2124
(
2125
- "application/pdf, application/zip, application/octet-stream, "
2126
- "text/csv, text/xml, application/xml, text/plain, "
2127
- "text/octet-stream, application/x-gzip, application/x-tar "
2128
- "application/"
2129
- "vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2125
+ "application/pdf,application/zip,application/octet-stream,"
2126
+ "text/csv,text/xml,application/xml,text/plain,application/json,"
2127
+ "text/octet-stream,application/x-gzip,application/x-tar,"
2128
+ "application/java-archive,text/x-java-source,java,"
2129
+ "application/javascript,video/jpeg,audio/x-aac,image/svg+xml,"
2130
+ "application/x-font-woff,application/x-7z-compressed,"
2131
+ "application/mp4,video/mp4,audio/mp4,video/x-msvideo,"
2132
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2130
2133
),
2131
2134
)
2135
+ if external_pdf :
2136
+ options .set_preference ("pdfjs.disabled" , True )
2137
+ else :
2138
+ options .set_preference ("pdfjs.disabled" , False )
2132
2139
if firefox_arg :
2133
2140
# Can be a comma-separated list of Firefox args
2134
2141
firefox_arg_list = firefox_arg .split ("," )
@@ -2768,6 +2775,7 @@ def get_remote_driver(
2768
2775
disable_csp ,
2769
2776
firefox_arg ,
2770
2777
firefox_pref ,
2778
+ external_pdf ,
2771
2779
)
2772
2780
capabilities = webdriver .FirefoxOptions ().to_capabilities ()
2773
2781
capabilities ["marionette" ] = True
@@ -3050,6 +3058,7 @@ def get_local_driver(
3050
3058
disable_csp ,
3051
3059
firefox_arg ,
3052
3060
firefox_pref ,
3061
+ external_pdf ,
3053
3062
)
3054
3063
if LOCAL_GECKODRIVER and os .path .exists (LOCAL_GECKODRIVER ):
3055
3064
try :
0 commit comments