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

Mac async popup #161

Merged
merged 2 commits into from
Jun 6, 2017
Merged

Mac async popup #161

merged 2 commits into from
Jun 6, 2017

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Feb 19, 2017

Manual application of electron patch electron/electron#8702
Additional updates (per electron/electron#8702)

Fixes brave/browser-laptop#5470

  • Default async to true for popup menus
  • fix lint errors
  • 1st commit: menus do not destroy themselves
  • 2nd commit: menus destroy themselves

@bsclifton
Copy link
Member Author

Right clicking anywhere inside a tab's webcontents causes this:

[66741:775:0227/015159.905320:ERROR:CONSOLE(219)] "Uncaught Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: Error processing argument at index 1, conversion failure from -1
Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: Error processing argument at index 1, conversion failure from -1
    at callFunction (/Users/clifton/Documents/browser-laptop-bootstrap/src/out/Release/Brave.app/Contents/Resources/electron.asar/browser/rpc-server.js:226:11)
    at EventEmitter.<anonymous> (/Users/clifton/Documents/browser-laptop-bootstrap/src/out/Release/Brave.app/Contents/Resources/electron.asar/browser/rpc-server.js:316:5)
    at emitMany (events.js:127:13)
    at EventEmitter.emit (events.js:201:7)
    at WebContents.<anonymous> (/Users/clifton/Documents/browser-laptop-bootstrap/src/out/Release/Brave.app/Contents/Resources/electron.asar/browser/api/web-contents.js:173:37)
    at emitTwo (events.js:106:13)
    at WebContents.emit (events.js:191:7)", source: extensions::remote (219)

@kevinsawicki
Copy link
Contributor

[66741:775:0227/015159.905320:ERROR:CONSOLE(219)] "Uncaught Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: Error processing argument at index 1, conversion failure from -1

This might be because you need this native mate change: electron/native-mate#10

bsclifton added a commit that referenced this pull request Feb 28, 2017
@bsclifton
Copy link
Member Author

bsclifton commented Feb 28, 2017

Thanks for the update @kevinsawicki, that definitely got me past that 😄

Seems now though that the menu is closing itself quickly after it opens. Will look at this later tonite
async-popup-mac

@kevinsawicki
Copy link
Contributor

Seems now though that the menu is closing itself quickly after it opens. Will look at this later tonite

Haven't seen this before, this could happen if the native menu object gets destroyed too early, that is why they are kept around in a map of nscoped_object until the menu is closed or closePopupAt is called.

@bridiver
Copy link
Collaborator

what is the status of this? Still trying to resolve the closing quickly issue?

@bsclifton
Copy link
Member Author

@bridiver yes- I haven't tried it recently though. I'm not sure I'll have time to look in this upcoming week

bsclifton added 2 commits May 24, 2017 01:51
Additional updates (per electron/electron#8702)

Fixes brave/browser-laptop#5470

- Default `async` to true for popup menus
- fix lint errors
- menus do not destroy themselves
@bsclifton bsclifton changed the title (NEEDS TESTING) Mac async popup Mac async popup May 24, 2017
@bsclifton bsclifton requested review from bridiver, bbondy and darkdh May 24, 2017 08:54
@bsclifton
Copy link
Member Author

Ready for review! 😄

There are two ways we can attempt to use this:

  • We can use the PR as-is; it will do the destroy when the popup closes. However, I had to grant friend access so that objects could call Destroy
  • We can remove the 2nd commit and then make the caller (ex: browser-laptop) explicitly call menuObject.destroy() when it's ready to be destroyed

@@ -4,7 +4,7 @@ use_relative_paths = True

deps = {
"vendor/node": "https://github.com/brave/node.git@f51b9ab8ff446ca7b13be0de1bc12b854b23938d",
"vendor/native_mate": "https://github.com/zcbenz/native-mate.git@b5e5de626c6a57e44c7e6448d8bbaaac475d493c",
"vendor/native_mate": "https://github.com/zcbenz/native-mate.git@ad0fd825663932ee3fa29ff935dfec99933bdd8c",
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes- it's needed per the comment here:
#161 (comment)

@bsclifton
Copy link
Member Author

browser-laptop portion of this change captured with brave/browser-laptop#9128

@bsclifton
Copy link
Member Author

cc: @darkdh

@bridiver
Copy link
Collaborator

bridiver commented Jun 6, 2017

would there be any benefit to not destroying them automatically?

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

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

I wonder why not destroying them in OnMenuClosed?
Just like #205 without window id.
If you intentionally make MenuController::Cancel return at first line, you can see the context menu is not window specific but a desktop global on Aura.

@@ -38,21 +43,32 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
location = gfx::Point(origin.x() + x, origin.y() + y);
}

int flags = MenuRunner::CONTEXT_MENU |
MenuRunner::HAS_MNEMONICS |
MenuRunner::ASYNC;
Copy link
Member

Choose a reason for hiding this comment

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

@@ -330,7 +330,8 @@ void URLBindings::Parse(
GURL gurl(url_string);
gin::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
if (gurl.has_username())
dict.Set("auth", gurl.username() + (gurl.has_password() ? ":" + gurl.password() : ""));
dict.Set("auth", gurl.username() + (gurl.has_password()
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

just saw this now- this just moves part of it onto the next line (since it went over 80 chars length, lint failed)

@bridiver bridiver merged commit 6f1e346 into master Jun 6, 2017
@bridiver bridiver deleted the mac-async-popup branch June 6, 2017 21:01
darkdh pushed a commit to brave/browser-laptop that referenced this pull request Jun 6, 2017
darkdh pushed a commit to brave/browser-laptop that referenced this pull request Jun 6, 2017
bsclifton added a commit to brave/browser-laptop that referenced this pull request Jun 7, 2017
@darkdh darkdh mentioned this pull request Jul 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening a context menu freezes video (ex: Youtube)
4 participants