-
Notifications
You must be signed in to change notification settings - Fork 975
Conversation
e74bd83
to
2f512b0
Compare
app/browser/tabs.js
Outdated
goBack: (state, action) => { | ||
action = makeImmutable(action) | ||
const tab = api.getWebContents(action.get('tabId')) | ||
tab.goBack() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please wrap this with if (tab && !tab.isDestroyed()) {
and all below as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/common/state/historyState.js
Outdated
} | ||
|
||
if (BrowserWindow.getFocusedWindow()) { | ||
BrowserWindow.getFocusedWindow().webContents.send(messages.SHOW_CONTEXT_MENU, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our dispatcher now has the ability to send messages to a particular window. So it's more preferable to do an app action with a window Id specified. See for example newWebContentsAdded
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually *State.js files specifically should not use any of these apis. They should manipulate state only and avoid other dependencies to make unit testing easier. The logic you have here looks like it probably belongs in a reducer
@@ -66,7 +65,7 @@ class Navigator extends ImmutableComponent { | |||
}) | |||
} | |||
} else { | |||
navAction.call(this.activeFrame) | |||
navAction.call(this, this.props.activeTab.get('tabId')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use this.props.tabId
to make the prop a primitive type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have this in yet. I didn't yet implement redux here, so we have what we have for now, but when I will add redux to it, we will have primitives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR only removes refs from Frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, no problem
35145b9
to
bc5e2aa
Compare
app/common/state/historyState.js
Outdated
icon: history.entries[index].icon, | ||
click: function (e) { | ||
if (eventUtil.isForSecondaryAction(e)) { | ||
appActions.createTabRequested({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also going to be a problem because you can't serialize the method call in the windowAction
7fabdb4
to
5e35810
Compare
js/actions/windowActions.js
Outdated
@@ -638,15 +638,15 @@ const windowActions = { | |||
* @param {Object} frameToSkip - Properties of the frame to keep audio | |||
*/ | |||
muteAllAudioExcept: function (frameToSkip) { | |||
let framePropsList = windowStore.getState().get('frames') | |||
/* let framePropsList = windowStore.getState().get('frames') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this isn't needed anymore can it just be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still necessary, but I need to refactor it, because if you require windowStore
in appAction (you are requiring it, because I am are calling windowActions in appStore) you are getting errors. I will move this logic from windowActions into reducer, so that we don't need store here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it in #8381
5876329
to
f81695d
Compare
Resolves brave#8322 Auditors: @bsclifton @bridiver Test Plan: - tests are green
f81695d
to
24b5036
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'd really like to make the changes in tabs.js and change the params in contextMenuState.js. The other comments are just nits that shouldn't block merging
app/browser/tabs.js
Outdated
}, | ||
|
||
getWindowId: () => { | ||
if (BrowserWindow.getFocusedWindow()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should probably be a getActiveWindowId
method on windows.js and return windowState.WINDOW_ID_NONE
instead of -1 just for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved
app/browser/tabs.js
Outdated
icon: null | ||
} | ||
|
||
if (url.startsWith('chrome-extension://')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use the appUrlUtil about page methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure which function should be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isTargetAboutUrl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
app/common/state/contextMenuState.js
Outdated
} | ||
|
||
const contextMenuState = { | ||
setContextMenu: (state, action) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the helpers are meant to be more general purpose so this should probably take detail
as a parameter instead of action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
app/common/state/contextMenuState.js
Outdated
return state | ||
}, | ||
|
||
onLongBacHistory: (state, action) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these two methods probably make more sense in the reducer. The state helpers are mostly just getters/setters for the state. I'm not adamantly opposed to leaving them here, but if they stay the params should be tabId, partitionNumber and history instead of action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
js/actions/appActions.js
Outdated
* Go back in a history for a given tab | ||
* @param {number} tabId - Tab id used for an action | ||
*/ | ||
onNavigateBack: function (tabId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit, but it would be more consistent to use onGoBack, onGoForward, etc...
app/common/state/contextMenuState.js
Outdated
return state | ||
}, | ||
|
||
onLongBacHistory: (state, action) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BacHistory -> BackHistory
38168e2
to
c5e6255
Compare
} | ||
|
||
if (!entry.icon) { | ||
entry.icon = getDefaultFaviconUrl(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work correctly? It looks like we normally get it using window
which isn't available here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are correct we are not receiving anything here, that's why I added if typeof undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updated
js/lib/urlutil.js
Outdated
@@ -353,7 +353,7 @@ const UrlUtil = { | |||
* @return {string} url The base favicon URL | |||
*/ | |||
getDefaultFaviconUrl: function (url) { | |||
if (UrlUtil.isURL(url)) { | |||
if (typeof window !== 'undefined' && UrlUtil.isURL(url)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can fix this by using urlParse
instead of window.URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
c5e6255
to
81aa4d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm if all the tests are passing
++ nice cleanup! 😄 |
git rebase -i
to squash commits (if needed).Resolves #8322
Auditors: @bsclifton @bridiver
Test Plan 1
Test Plan 2
Test Plan 3
Test Plan 4