Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This module implements the attributes of the <webview> tag. | 5 // This module implements the attributes of the <webview> tag. |
| 6 | 6 |
| 7 var GuestViewInternal = | 7 var GuestViewInternal = |
| 8 require('binding').Binding.create('guestViewInternal').generate(); | 8 require('binding').Binding.create('guestViewInternal').generate(); |
| 9 var WebViewImpl = require('webView').WebViewImpl; | 9 var WebViewImpl = require('webView').WebViewImpl; |
| 10 var WebViewConstants = require('webViewConstants').WebViewConstants; | 10 var WebViewConstants = require('webViewConstants').WebViewConstants; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 SrcAttribute.prototype.__proto__ = WebViewAttribute.prototype; | 190 SrcAttribute.prototype.__proto__ = WebViewAttribute.prototype; |
| 191 | 191 |
| 192 SrcAttribute.prototype.handleMutation = function(oldValue, newValue) { | 192 SrcAttribute.prototype.handleMutation = function(oldValue, newValue) { |
| 193 // Once we have navigated, we don't allow clearing the src attribute. | 193 // Once we have navigated, we don't allow clearing the src attribute. |
| 194 // Once <webview> enters a navigated state, it cannot return to a | 194 // Once <webview> enters a navigated state, it cannot return to a |
| 195 // placeholder state. | 195 // placeholder state. |
| 196 if (!newValue && oldValue) { | 196 if (!newValue && oldValue) { |
| 197 // src attribute changes normally initiate a navigation. We suppress | 197 // src attribute changes normally initiate a navigation. We suppress |
| 198 // the next src attribute handler call to avoid reloading the page | 198 // the next src attribute handler call to avoid reloading the page |
| 199 // on every guest-initiated navigation. | 199 // on every guest-initiated navigation. |
| 200 // takeRecords() needed to clear queued up src mutations. | |
|
Fady Samuel
2014/11/10 19:25:39
This doesn't explain why this was causing an issue
paulmeyer
2014/11/10 19:35:48
Done.
| |
| 201 this.observer.takeRecords(); | |
| 200 this.setValueIgnoreMutation(oldValue); | 202 this.setValueIgnoreMutation(oldValue); |
| 201 return; | 203 return; |
| 202 } | 204 } |
| 203 this.webViewImpl.parseSrcAttribute(); | 205 this.webViewImpl.parseSrcAttribute(); |
| 204 }; | 206 }; |
| 205 | 207 |
| 206 // The purpose of this mutation observer is to catch assignment to the src | 208 // The purpose of this mutation observer is to catch assignment to the src |
| 207 // attribute without any changes to its value. This is useful in the case | 209 // attribute without any changes to its value. This is useful in the case |
| 208 // where the webview guest has crashed and navigating to the same address | 210 // where the webview guest has crashed and navigating to the same address |
| 209 // spawns off a new process. | 211 // spawns off a new process. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 | 248 |
| 247 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, | 249 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, |
| 248 WebViewConstants.ATTRIBUTE_MAXWIDTH, | 250 WebViewConstants.ATTRIBUTE_MAXWIDTH, |
| 249 WebViewConstants.ATTRIBUTE_MINHEIGHT, | 251 WebViewConstants.ATTRIBUTE_MINHEIGHT, |
| 250 WebViewConstants.ATTRIBUTE_MINWIDTH]; | 252 WebViewConstants.ATTRIBUTE_MINWIDTH]; |
| 251 for (var i = 0; autosizeAttributes[i]; ++i) { | 253 for (var i = 0; autosizeAttributes[i]; ++i) { |
| 252 this.attributes[autosizeAttributes[i]] = | 254 this.attributes[autosizeAttributes[i]] = |
| 253 new AutosizeDimensionAttribute(autosizeAttributes[i], this); | 255 new AutosizeDimensionAttribute(autosizeAttributes[i], this); |
| 254 } | 256 } |
| 255 }; | 257 }; |
| OLD | NEW |