Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Screenshot mode] Create plugin to provide "screenshot mode" awareness #99627

Merged
merged 23 commits into from
May 19, 2021
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3bb2aca
initial version of the screenshot mode service
jloleysens May 10, 2021
0472bcf
Merge branch 'master' into screenshot-mode/create-plugin
kibanamachine May 11, 2021
c488af9
Merge branch 'master' into screenshot-mode/create-plugin
kibanamachine May 12, 2021
8a4e1d0
First iteration of client side of screenshot mode plugin
jloleysens May 12, 2021
c48417d
First implementation of server-side logic for detecting
jloleysens May 12, 2021
da45eef
fix some type issues and do a small refactor
jloleysens May 12, 2021
79ed40a
fix size limits, docs and ts issues
jloleysens May 12, 2021
15f05f2
fixed types issues and made sure screenshot mode is correctly detecte…
jloleysens May 14, 2021
c10905b
Merge branch 'master' into screenshot-mode/create-plugin
kibanamachine May 14, 2021
2b10497
Moved the screenshot mode header definition to common
jloleysens May 14, 2021
aaab2af
move require() to screenshotMode plugin
tsullivan May 14, 2021
7dc5c0f
Update chromium_driver.ts
tsullivan May 14, 2021
76242a6
Merge pull request #3 from tsullivan/screenshot-mode/create-plugin
jloleysens May 17, 2021
4f95774
Merge branch 'master' into screenshot-mode/create-plugin
kibanamachine May 17, 2021
69357bf
cleaned up some comments, minor refactor in ReportingCore and
jloleysens May 17, 2021
cb95a41
fix export
jloleysens May 17, 2021
a0b9e3b
Expanded server-side screenshot mode contract with function that
jloleysens May 17, 2021
755db33
added comments to explain use of literal value rather than external r…
jloleysens May 17, 2021
b96bf45
updated comment
jloleysens May 18, 2021
788078c
Merge branch 'master' into screenshot-mode/create-plugin
kibanamachine May 18, 2021
8eb5139
update reporting example
tsullivan May 18, 2021
a6eef5b
Merge pull request #4 from tsullivan/screenshot-mode/create-plugin
jloleysens May 19, 2021
e5af77f
Merge branch 'master' into screenshot-mode/create-plugin
kibanamachine May 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added comments to explain use of literal value rather than external r…
…eference
  • Loading branch information
jloleysens committed May 17, 2021
commit 755db330cc451f33fd1165e357a0323c89e79768
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* Side Public License, v 1.
*/

// The functionality in this file is intended to be used both in public and server
// code even but targets a browser environment. Reporting uses these functions when starting
// puppeteer to set the current browser into "screenshot" mode.

export const KBN_SCREENSHOT_MODE_ENABLED_KEY = '__KBN_SCREENSHOT_MODE_ENABLED_KEY__';

/**
Expand Down Expand Up @@ -33,19 +37,27 @@ export const getScreenshotMode = (): boolean => {
* references as possible to make it portable. For instance, running inside puppeteer.
*/
export const setScreenshotModeEnabled = () => {
Object.defineProperty(window, '__KBN_SCREENSHOT_MODE_ENABLED_KEY__', {
enumerable: true,
writable: true,
configurable: false,
value: true,
});
Object.defineProperty(
window,
'__KBN_SCREENSHOT_MODE_ENABLED_KEY__', // Literal value to prevent adding an external reference
{
enumerable: true,
writable: true,
configurable: false,
value: true,
}
);
};

export const setScreenshotModeDisabled = () => {
Object.defineProperty(window, '__KBN_SCREENSHOT_MODE_ENABLED_KEY__', {
enumerable: true,
writable: true,
configurable: false,
value: undefined,
});
Object.defineProperty(
window,
'__KBN_SCREENSHOT_MODE_ENABLED_KEY__', // Literal value to prevent adding an external reference
{
enumerable: true,
writable: true,
configurable: false,
value: undefined,
}
);
};