Skip to content

Commit bd71249

Browse files
committed
fix(render-page): ensure chromerenderer can handle raw filename as first arg to Page#render
1 parent 1f12d45 commit bd71249

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/page.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ export class Page {
102102
async render(options = {}, ...args) {
103103
assert.ok(!this.isDestroyed && !this.isDestroying && this.isLoaded);
104104

105-
if (isString(options)) {
105+
let pagePathParamKey = this.renderer.constructor.pagePathParamKey;
106+
107+
if (isString(pagePathParamKey) && isString(options)) {
106108
let filename = options;
107109

108110
options = isPresent(args[0]) ? args[0] : {};
109-
options.filename = filename;
111+
options[pagePathParamKey] = filename;
110112
}
111113

112114
if (isString(options.filename) && !isString(options.format)) {

src/renderers/chrome/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export class ChromeRenderer extends Renderer {
1717
this._DEFAULT_BOOT_OPTIONS = value;
1818
}
1919

20+
static get pagePathParamKey() {
21+
return 'path';
22+
}
23+
2024
constructor(attrs = {}) {
2125
super(attrs);
2226

src/renderers/phantom/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export class PhantomRenderer extends Renderer {
4040
return denodeify(request);
4141
}
4242

43+
static get pagePathParamKey() {
44+
return 'filename';
45+
}
46+
4347
constructor(attrs = {}) {
4448
super(attrs);
4549

0 commit comments

Comments
 (0)