Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: extensions/renderer/resources/guest_view/web_view_attributes.js

Issue 692333009: Fixed the problem at the source of the flaky WebViewTest.ShimArcAttribute test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another small fix. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/apps/web_view_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 }; 182 };
183 183
184 // Attribute that handles the location and navigation of the webview. 184 // Attribute that handles the location and navigation of the webview.
185 function SrcAttribute(webViewImpl) { 185 function SrcAttribute(webViewImpl) {
186 WebViewAttribute.call(this, WebViewConstants.ATTRIBUTE_SRC, webViewImpl); 186 WebViewAttribute.call(this, WebViewConstants.ATTRIBUTE_SRC, webViewImpl);
187 this.setupMutationObserver(); 187 this.setupMutationObserver();
188 } 188 }
189 189
190 SrcAttribute.prototype.__proto__ = WebViewAttribute.prototype; 190 SrcAttribute.prototype.__proto__ = WebViewAttribute.prototype;
191 191
192 SrcAttribute.prototype.setValueIgnoreMutation = function(value) {
193 // takeRecords() is needed to clear queued up src mutations. Without it, it is
194 // possible for this change to get picked up asyncronously by src's mutation
195 // observer |observer|, and then get handled even though we do not want to
196 // handle this mutation.
197 this.observer.takeRecords();
198 this.ignoreMutation = true;
199 this.webViewImpl.webviewNode.setAttribute(this.name, value || '');
200 this.ignoreMutation = false;
201 }
202
192 SrcAttribute.prototype.handleMutation = function(oldValue, newValue) { 203 SrcAttribute.prototype.handleMutation = function(oldValue, newValue) {
193 // Once we have navigated, we don't allow clearing the src attribute. 204 // Once we have navigated, we don't allow clearing the src attribute.
194 // Once <webview> enters a navigated state, it cannot return to a 205 // Once <webview> enters a navigated state, it cannot return to a
195 // placeholder state. 206 // placeholder state.
196 if (!newValue && oldValue) { 207 if (!newValue && oldValue) {
197 // src attribute changes normally initiate a navigation. We suppress 208 // src attribute changes normally initiate a navigation. We suppress
198 // the next src attribute handler call to avoid reloading the page 209 // the next src attribute handler call to avoid reloading the page
199 // on every guest-initiated navigation. 210 // on every guest-initiated navigation.
200 this.setValueIgnoreMutation(oldValue); 211 this.setValueIgnoreMutation(oldValue);
201 return; 212 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 257
247 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, 258 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT,
248 WebViewConstants.ATTRIBUTE_MAXWIDTH, 259 WebViewConstants.ATTRIBUTE_MAXWIDTH,
249 WebViewConstants.ATTRIBUTE_MINHEIGHT, 260 WebViewConstants.ATTRIBUTE_MINHEIGHT,
250 WebViewConstants.ATTRIBUTE_MINWIDTH]; 261 WebViewConstants.ATTRIBUTE_MINWIDTH];
251 for (var i = 0; autosizeAttributes[i]; ++i) { 262 for (var i = 0; autosizeAttributes[i]; ++i) {
252 this.attributes[autosizeAttributes[i]] = 263 this.attributes[autosizeAttributes[i]] =
253 new AutosizeDimensionAttribute(autosizeAttributes[i], this); 264 new AutosizeDimensionAttribute(autosizeAttributes[i], this);
254 } 265 }
255 }; 266 };
OLDNEW
« no previous file with comments | « chrome/browser/apps/web_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698