summaryrefslogtreecommitdiffstats
path: root/toolkit/components/pdfjs/test/browser_pdfjs_not_default.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/pdfjs/test/browser_pdfjs_not_default.js')
-rw-r--r--toolkit/components/pdfjs/test/browser_pdfjs_not_default.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/toolkit/components/pdfjs/test/browser_pdfjs_not_default.js b/toolkit/components/pdfjs/test/browser_pdfjs_not_default.js
new file mode 100644
index 0000000000..ea05348bc9
--- /dev/null
+++ b/toolkit/components/pdfjs/test/browser_pdfjs_not_default.js
@@ -0,0 +1,26 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+add_task(async function test_pdfjs_not_default() {
+ var oldAction = changeMimeHandler(Ci.nsIHandlerInfo.useSystemDefault, true);
+ let dirFileObj = getChromeDir(getResolvedURI(gTestPath));
+ dirFileObj.append("file_pdfjs_test.pdf");
+
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ dirFileObj.path
+ );
+
+ // If we don't have the Pdfjs actor loaded, this will throw
+ await getPdfjsActor();
+
+ changeMimeHandler(oldAction[0], oldAction[1]);
+
+ gBrowser.removeTab(tab);
+});
+
+function getPdfjsActor() {
+ let win = Services.wm.getMostRecentWindow("navigator:browser");
+ let selectedBrowser = win.gBrowser.selectedBrowser;
+ return selectedBrowser.browsingContext.currentWindowGlobal.getActor("Pdfjs");
+}