Skip to content

Commit

Permalink
Merge pull request mozilla#5691 from Snuffleupagus/viewer-shadow
Browse files Browse the repository at this point in the history
Use the |shadow| function from src/shared/util.js in viewer.js
  • Loading branch information
timvandermeij authored and speedplane committed Feb 24, 2015
2 parents 9d5f001 + bb4d09e commit 87855ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 37 deletions.
1 change: 1 addition & 0 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ function shadow(obj, prop, value) {
writable: false });
return value;
}
PDFJS.shadow = shadow;

var PasswordResponses = PDFJS.PasswordResponses = {
NEED_PASSWORD: 1,
Expand Down
51 changes: 14 additions & 37 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,8 @@ var PDFViewerApplication = {
get supportsPrinting() {
var canvas = document.createElement('canvas');
var value = 'mozPrintCallback' in canvas;
// shadow
Object.defineProperty(this, 'supportsPrinting', { value: value,
enumerable: true,
configurable: true,
writable: false });
return value;

return PDFJS.shadow(this, 'supportsPrinting', value);
},

get supportsFullscreen() {
Expand All @@ -319,59 +315,40 @@ var PDFViewerApplication = {
support = false;
}

Object.defineProperty(this, 'supportsFullscreen', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
return PDFJS.shadow(this, 'supportsFullscreen', support);
},

get supportsIntegratedFind() {
var support = false;
//#if !(FIREFOX || MOZCENTRAL)
//#else
//#if (FIREFOX || MOZCENTRAL)
// support = FirefoxCom.requestSync('supportsIntegratedFind');
//#endif
Object.defineProperty(this, 'supportsIntegratedFind', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;

return PDFJS.shadow(this, 'supportsIntegratedFind', support);
},

get supportsDocumentFonts() {
var support = true;
//#if !(FIREFOX || MOZCENTRAL)
//#else
//#if (FIREFOX || MOZCENTRAL)
// support = FirefoxCom.requestSync('supportsDocumentFonts');
//#endif
Object.defineProperty(this, 'supportsDocumentFonts', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;

return PDFJS.shadow(this, 'supportsDocumentFonts', support);
},

get supportsDocumentColors() {
var support = true;
//#if !(FIREFOX || MOZCENTRAL)
//#else
//#if (FIREFOX || MOZCENTRAL)
// support = FirefoxCom.requestSync('supportsDocumentColors');
//#endif
Object.defineProperty(this, 'supportsDocumentColors', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;

return PDFJS.shadow(this, 'supportsDocumentColors', support);
},

get loadingBar() {
var bar = new ProgressBar('#loadingBar', {});
Object.defineProperty(this, 'loadingBar', { value: bar,
enumerable: true,
configurable: true,
writable: false });
return bar;

return PDFJS.shadow(this, 'loadingBar', bar);
},

//#if (FIREFOX || MOZCENTRAL)
Expand Down

0 comments on commit 87855ac

Please sign in to comment.