Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Make sure about: pages always get proper state
Browse files Browse the repository at this point in the history
As a side effect of getting rid of a bunch of wasted re-renders, about pages could get in a state with state that is not sent to them.  This removes that race condition

Fix #2875. Fix #2881

Auditors: @diracdeltas
  • Loading branch information
bbondy committed Aug 2, 2016
1 parent d021f51 commit 3da5c25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/about/entry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const ReactDOM = require('react-dom')
const { getSourceAboutUrl, getBaseUrl } = require('../lib/appUrlUtil')
const { ABOUT_COMPONENT_INITIALIZED } = require('../constants/messages')
const ipc = window.chrome.ipc

let element
Expand Down Expand Up @@ -43,4 +44,5 @@ if (element) {
component.setState(detail)
}
})
ipc.sendToHost(ABOUT_COMPONENT_INITIALIZED)
}
3 changes: 3 additions & 0 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ class Frame extends ImmutableComponent {
this.webview.addEventListener('ipc-message', (e) => {
let method = () => {}
switch (e.channel) {
case messages.ABOUT_COMPONENT_INITIALIZED:
this.updateAboutDetails()
break
case messages.GOT_CANVAS_FINGERPRINTING:
method = (detail) => {
const description = [detail.type, detail.scriptUrl || this.props.location].join(': ')
Expand Down
1 change: 1 addition & 0 deletions js/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const messages = {
RELOAD_URL: _,
DISPATCH_ACTION: _,
CHECK_FLASH_INSTALLED: _,
ABOUT_COMPONENT_INITIALIZED: _,
// HTTPS
CERT_ERROR_ACCEPTED: _, /** @arg {string} url where a cert error was accepted */
CHECK_CERT_ERROR_ACCEPTED: _, /** @arg {string} url to check cert error, @arg {number} key of frame */
Expand Down

1 comment on commit 3da5c25

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

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

++

Please sign in to comment.