@@ -19,6 +19,11 @@ Tab = function (_React$Component) {_inherits(Tab, _React$Component);
19
19
} _createClass ( Tab , [ { key : "componentWillMount" , value : function componentWillMount ( )
20
20
{
21
21
this . resolveFavIconUrl ( ) ;
22
+ } } , { key : "componentDidUpdate" , value : function componentDidUpdate (
23
+ prevProps , prevState ) {
24
+ if ( this . props . tab . favIconUrl != prevProps . tab . favIconUrl ) {
25
+ this . resolveFavIconUrl ( ) ;
26
+ }
22
27
} } , { key : "render" , value : function render ( )
23
28
{
24
29
var children = [ ] ;
@@ -138,8 +143,9 @@ Tab = function (_React$Component) {_inherits(Tab, _React$Component);
138
143
139
144
e ) {
140
145
if ( ! ! this . props . drag ) {
146
+ var url = this . props . tab . url || this . props . tab . pendingUrl ;
141
147
e . dataTransfer . setData ( "Text" , this . props . tab . id ) ;
142
- e . dataTransfer . setData ( "text/uri-list" , this . props . tab . url || "" ) ;
148
+ e . dataTransfer . setData ( "text/uri-list" , url || "" ) ;
143
149
this . props . drag ( e , this . props . tab . id ) ;
144
150
} else {
145
151
return false ;
@@ -170,40 +176,42 @@ Tab = function (_React$Component) {_inherits(Tab, _React$Component);
170
176
} else {
171
177
return false ;
172
178
}
173
- } } , { key : "resolveFavIconUrl" , value : function ( ) { var _ref2 = _asyncToGenerator ( /*#__PURE__*/ regeneratorRuntime . mark ( function _callee2 ( ) { var image , favIcons , iconUrl , iconName ; return regeneratorRuntime . wrap ( function _callee2$ ( _context2 ) { while ( 1 ) { switch ( _context2 . prev = _context2 . next ) { case 0 :
174
-
175
-
176
- // firefox screenshots; needs <all_urls>
177
- // if(!!browser.tabs.captureTab) {
178
- // console.log("tabs captureTab");
179
- // image = await browser.tabs.captureTab(this.props.tab.id);
180
- // image = "url(" + image + ")";
181
- // }else
182
- if ( ! ! this . props . tab . url && this . props . tab . url . indexOf ( "chrome://" ) !== 0 && this . props . tab . url . indexOf ( "about:" ) !== 0 ) {
183
- // chrome screenshots / only for active tabs; needs <all_urls>
184
- // if(!!browser.tabs.captureVisibleTab && this.props.tab.highlighted) {
185
- // console.log("tabsCapture");
186
- // try {
187
- // image = await browser.tabs.captureVisibleTab( this.props.window.id, {} );
188
- // //console.log(image);
189
- // } catch ( e ) {
190
- // console.log(e.message);
191
- // }
192
- // image = "url(" + image + ")";
193
- // }else{
194
- image = this . props . tab . favIconUrl ? "url(" + this . props . tab . favIconUrl + ")" : "" ;
195
- //}
196
- } else {
197
- favIcons = [ "bookmarks" , "chrome" , "crashes" , "downloads" , "extensions" , "flags" , "history" , "settings" ] ;
198
- iconUrl = this . props . tab . url || "" ;
199
- iconName = "" ;
200
- if ( iconUrl . length > 9 ) iconName = iconUrl . slice ( 9 ) . match ( / ^ \w + / g) ;
201
- image = ! iconName || favIcons . indexOf ( iconName [ 0 ] ) < 0 ? "" : "url(../images/chrome/" + iconName [ 0 ] + ".png)" ;
202
- }
203
- this . setState ( {
204
- favIcon : image } ) ; case 2 :case "end" :return _context2 . stop ( ) ; } } } , _callee2 , this ) ; } ) ) ; function resolveFavIconUrl ( ) { return _ref2 . apply ( this , arguments ) ; } return resolveFavIconUrl ; } ( ) } , { key : "stopProp" , value : function stopProp (
205
-
179
+ } } , { key : "resolveFavIconUrl" , value : function resolveFavIconUrl ( )
180
+ {
181
+ var image ;
182
+ // firefox screenshots; needs <all_urls>
183
+ // if(!!browser.tabs.captureTab) {
184
+ // console.log("tabs captureTab");
185
+ // image = await browser.tabs.captureTab(this.props.tab.id);
186
+ // image = "url(" + image + ")";
187
+ // }else
188
+ var url = this . props . tab . url || this . props . tab . pendingUrl ;
189
+ if ( ! ! url && url . indexOf ( "chrome://" ) !== 0 && url . indexOf ( "about:" ) !== 0 ) {
190
+ // chrome screenshots / only for active tabs; needs <all_urls>
191
+ // if(!!browser.tabs.captureVisibleTab && this.props.tab.highlighted) {
192
+ // console.log("tabsCapture");
193
+ // try {
194
+ // image = await browser.tabs.captureVisibleTab( this.props.window.id, {} );
195
+ // //console.log(image);
196
+ // } catch ( e ) {
197
+ // console.log(e.message);
198
+ // }
199
+ // image = "url(" + image + ")";
200
+ // }else{
201
+ image = this . props . tab . favIconUrl ? "url(" + this . props . tab . favIconUrl + ")" : "" ;
202
+ //}
203
+ } else {
204
+ var favIcons = [ "bookmarks" , "chrome" , "crashes" , "downloads" , "extensions" , "flags" , "history" , "settings" ] ;
205
+ var iconUrl = url || "" ;
206
+ var iconName = "" ;
207
+ if ( iconUrl . length > 9 ) iconName = iconUrl . slice ( 9 ) . match ( / ^ \w + / g) ;
208
+ image = ! iconName || favIcons . indexOf ( iconName [ 0 ] ) < 0 ? "" : "url(../images/chrome/" + iconName [ 0 ] + ".png)" ;
209
+ }
210
+ if ( this . state . favIcon == image ) return ;
211
+ this . setState ( {
212
+ favIcon : image } ) ;
206
213
214
+ } } , { key : "stopProp" , value : function stopProp (
207
215
e ) {
208
216
if ( e && e . nativeEvent ) {
209
217
e . nativeEvent . preventDefault ( ) ;
0 commit comments