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

Added setter to observed properties #57

Closed
Closed
Changes from 1 commit
Commits
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
3 changes: 3 additions & 0 deletions inject-dist/observers.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ function initializeObserver(pathname) {

// Return the original feature.
return original;
},
set: () => {
return original;
Copy link
Member

Choose a reason for hiding this comment

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

If an application attempts to overwrite one of these properties, would this prevent it from working, since it's not actually setting the new value?

Worth testing if this works:

Suggested change
set: () => {
return original;
set: (new) => {
original = new;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The above gives a number of issues (undefined or null), while my proposed solution removes any setters which are added through the app's code. So neither is a good solution as yet. I will try investigate the null/undefined to understand what's going on .

In the meantime I tried to rewrite it using a proxy but we are unable to proxy all objects. For example, it is not allowing me to proxy window.navigator.

}
});
} catch (e) {
Expand Down