mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Addresses review feedback from mozilla central. See bugzilla bug 752676.
This commit is contained in:
parent
121040a5dc
commit
da94701c7b
4 changed files with 97 additions and 94 deletions
|
@ -1,6 +1,5 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
|
||||
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
|
||||
|
@ -8,8 +7,6 @@ const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
|
|||
function test() {
|
||||
var tab;
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
|
||||
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
|
||||
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
|
||||
|
@ -35,9 +32,7 @@ function test() {
|
|||
|
||||
// Runs tests after all 'load' event handlers have fired off
|
||||
setTimeout(function() {
|
||||
runTests(document, window, function() {
|
||||
finish();
|
||||
});
|
||||
runTests(document, window, finish);
|
||||
}, 0);
|
||||
}, true);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
|
||||
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
|
||||
|
||||
function test() {
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
var tab;
|
||||
|
||||
var oldAction = changeMimeHandler(Ci.nsIHandlerInfo.useSystemDefault, true);
|
||||
|
||||
var tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
|
||||
//
|
||||
// Test: "Open with" dialog comes up when pdf.js is not selected as the default
|
||||
// handler.
|
||||
|
@ -23,14 +18,9 @@ function test() {
|
|||
changeMimeHandler(oldAction[0], oldAction[1]);
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
|
||||
var newTabBrowser = gBrowser.getBrowserForTab(tab);
|
||||
}
|
||||
|
||||
function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
|
||||
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
|
||||
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
|
||||
|
@ -44,7 +34,6 @@ function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
|
|||
Services.obs.notifyObservers(null, 'pdfjs:handlerChanged', null);
|
||||
|
||||
// Refresh data
|
||||
mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
|
||||
handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
|
||||
|
||||
//
|
||||
|
@ -57,8 +46,6 @@ function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
|
|||
}
|
||||
|
||||
function addWindowListener(aURL, aCallback) {
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
Services.wm.addListener({
|
||||
onOpenWindow: function(aXULWindow) {
|
||||
info("window opened, waiting for focus");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue