Skip to content

remove after dependency #79

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

Merged
merged 5 commits into from
Nov 20, 2019
Merged

remove after dependency #79

merged 5 commits into from
Nov 20, 2019

Conversation

danieljackins
Copy link
Contributor

@danieljackins danieljackins commented Nov 18, 2019

For https://segment.atlassian.net/browse/LIB-1430

This PR removes the dependency on "after" which violated customer CSP with a new Function() call.

return this._initialPageSkipped = true;
}

return page.apply(this, arguments);
Copy link
Contributor

@fathyb fathyb Nov 19, 2019

Choose a reason for hiding this comment

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

Is there a need to store initialPageSkipped on the instance? It could be simplified to:

  var page = this.page;
  var initialPageSkipped = false;
  this.page = function() {
    if (this._assumesPageview && !initialPageSkipped) {
      return initialPageSkipped = true;
    }

    return page.apply(this, arguments);
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. fixed!

lib/protos.js Outdated
if (this._assumesPageview) {
if (this._initialPageSkipped) return page.apply(this, arguments);

return this._initialPageSkipped = true;
Copy link

Choose a reason for hiding this comment

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

similar to my question #123

what do we expect this method to return ? It's a bit confusing reading that line, because it appears that we're returning a boolean, but that doesn't appear to be the intention. If the method return null, it might be clearer if we just used two lines, one to set the var, the other to explicitly return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

Copy link
Contributor

@fathyb fathyb left a comment

Choose a reason for hiding this comment

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

🔥

@danieljackins danieljackins merged commit 6e6df4f into master Nov 20, 2019
@danieljackins danieljackins deleted the djackins/eval branch November 20, 2019 19:15
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.

4 participants