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

[ENGG-1692] feat: warning for CSP errors in dynamic response rules #1726

Merged
merged 8 commits into from
May 23, 2024

Conversation

nafees87n
Copy link
Contributor

Closes issue:

πŸ“œ Summary of changes:

βœ… Checklist:

  • Make sure linting and unit tests pass.
  • No install/build warnings introduced.
  • Verified UI in browser.
  • For UI changes, added/updated analytics events (if applicable).
  • For changes in extension's code, manually tested in Chrome and Firefox.
  • For changes in extension's code, both MV2 and MV3 are covered.
  • Added/updated unit tests for this change.
  • Raised pull request to update corresponding documentation (if already exists).

πŸ§ͺ Test instructions:

πŸ”— Other references:

Copy link

deepsource-io bot commented May 22, 2024

Here's the code health analysis summary for commits 8be50b1..25c4430. View details on DeepSourceΒ β†—.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Shell LogoShellβœ…Β SuccessView CheckΒ β†—
DeepSource JavaScript LogoJavaScript❌ Failure
❗ 62 occurences introduced
🎯 54 occurences resolved
View CheckΒ β†—

πŸ’‘ If you’re a repository administrator, you can configure the quality gates from the settings.

@nafees87n nafees87n requested a review from wrongsahil May 22, 2024 11:56
Comment on lines 187 to 210
const getFunctionFromCode = (() => {
let logShown = false;

return (code, ruleType) => {
try {
return new Function("args", `return (${code})(args);`);
} catch (e) {
notifyOnErrorOccurred({
initiatorDomain: location.origin,
url: location.href,
}).then(() => {
if (!logShown) {
logShown = true;
console.log(
`%cRequestly%c Please reload the page for ${ruleType} rule to take effect`,
"color: #3c89e8; padding: 1px 5px; border-radius: 4px; border: 1px solid #91caff;",
"color: red; font-style: italic"
);
}
});
return () => {};
}
};
})();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep logShown outside the method. This looks weird read as the method is called at the same time

@wrongsahil wrongsahil merged commit 245f97f into master May 23, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants