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

is "window.parent && window.parent.postMessage" check buggy? #957

Closed
zepumph opened this issue Sep 25, 2018 · 2 comments
Closed

is "window.parent && window.parent.postMessage" check buggy? #957

zepumph opened this issue Sep 25, 2018 · 2 comments
Assignees

Comments

@zepumph
Copy link
Member

zepumph commented Sep 25, 2018

With @samreid recently while running CAF in phet-io mode, we noticed that ColorProfile.reportColor() was sending a postMessage to itself. That was being picked up by the phet-io message listener, producing some buggy data stream.

PhET-iO Events Stream 31 chargesAndFields.controller.input.mouseUpEmitter emitted {"args":[{"x":270.3999938964844,"y":407},{"pointerId":1,"pointerType":"mouse","clientX":270.3999938964844,"clientY":407,"button":0,"which":1}]} 32 chargesAndFields.globals.options.projectorCheckbox.toggledEmitter emitted {"args":[true]} 33 chargesAndFields.globals.projectorColorsProperty changed {"oldValue":false,"newValue":true} 34 chargesAndFields.colorProfile.profileNameProperty changed {"oldValue":"default","newValue":"projector"} 35 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"background","value":"#ffffff","phetioEventType":"wrapper"} 36 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"checkbox","value":"#000000","phetioEventType":"wrapper"} 37 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"checkboxBackground","value":"#ffffff","phetioEventType":"wrapper"} 38 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"controlPanelBorder","value":"#c0c0c0","phetioEventType":"wrapper"} 39 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"controlPanelFill","value":"#eeeeee","phetioEventType":"wrapper"} 40 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"controlPanelText","value":"#000000","phetioEventType":"wrapper"} 41 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricFieldGridSaturation","value":"#ff0000","phetioEventType":"wrapper"} 42 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricFieldGridZero","value":"#ffffff","phetioEventType":"wrapper"} 43 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricFieldSensorCircleFill","value":"#ff9900","phetioEventType":"wrapper"} 44 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricFieldSensorCircleStroke","value":"#000000","phetioEventType":"wrapper"} 45 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricFieldSensorLabel","value":"#000000","phetioEventType":"wrapper"} 46 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricPotentialGridSaturationPositive","value":"#d20000","phetioEventType":"wrapper"} 47 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricPotentialGridZero","value":"#ffffff","phetioEventType":"wrapper"} 48 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricPotentialLine","value":"#000000","phetioEventType":"wrapper"} 49 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricPotentialSensorCircleStroke","value":"#000000","phetioEventType":"wrapper"} 50 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricPotentialSensorCrosshairStroke","value":"#000000","phetioEventType":"wrapper"} 51 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"electricPotentialSensorTextPanelBorder","value":"#fafafa","phetioEventType":"wrapper"} 52 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"enclosureBorder","value":"#c0c0c0","phetioEventType":"wrapper"} 53 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"enclosureFill","value":"#eeeeee","phetioEventType":"wrapper"} 54 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"enclosureText","value":"#000000","phetioEventType":"wrapper"} 55 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"gridLengthScaleArrowFill","value":"#ff9900","phetioEventType":"wrapper"} 56 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"gridLengthScaleArrowStroke","value":"#ff0000","phetioEventType":"wrapper"} 57 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"gridStroke","value":"#ffcc33","phetioEventType":"wrapper"} 58 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"gridTextFill","value":"#000000","phetioEventType":"wrapper"} 59 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"measuringTapeText","value":"#000000","phetioEventType":"wrapper"} 60 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"reversedBackground","value":"#000000","phetioEventType":"wrapper"} 61 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"voltageLabel","value":"#000000","phetioEventType":"wrapper"} 62 chargesAndFields.phetioCommandProcessor invoked {"type":"reportColor","name":"voltageLabelBackground","value":"#ffffff","phetioEventType":"wrapper"}

We found that if parent is not another frame, then window.parent === window.
Disregarding the potentially buggy behavior in PhET-iO that allowed these color profile events to be picked up by the data stream, is this the best check to be used (14 times) across the project?

Do we want these postMessages potentially sending to their own frame?

@jessegreenberg
Copy link

@zepumph is this a duplicate of #958?

@zepumph
Copy link
Member Author

zepumph commented Jun 25, 2019

Yes sorry, not sure how that happened.

@zepumph zepumph closed this as completed Jun 25, 2019
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

No branches or pull requests

2 participants