Skip to content

Commit

Permalink
fixed arguments passed to nw.Window API callbacks
Browse files Browse the repository at this point in the history
Two bugs brings from commit bc016d4:
* missing `height` argument to `resize` event (fixed nwjs#4993)
* should use `self` instead of `this` in `navigation` event callbacks
  • Loading branch information
Cong Liu committed Jul 7, 2016
1 parent 998ac54 commit 39dee16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/resources/api_nw_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ nw_binding.registerCustomHook(function(bindingsAPI) {
case 'navigation':
var j = wrap(function(frame, url, policy, context) {
policy.ignore = function () { this.val = 'ignore'; };
callback.call(this, frame, url, policy, context);
callback.call(self, frame, url, policy, context);
});
this.onNavigation.addListener(j);
break;
Expand All @@ -280,7 +280,7 @@ nw_binding.registerCustomHook(function(bindingsAPI) {
break;
case 'resize':
var l = wrap(function() {
callback.call(self.width, self.height);
callback.call(self, self.width, self.height);
});
this.appWindow.onResized.addListener(l);
return this; //return early
Expand Down

0 comments on commit 39dee16

Please sign in to comment.