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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js

Issue 2837943003: DevTools: trim the leading BOM char when parsing web manifest. (Closed)
Patch Set: Created 3 years, 7 months 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 | « no previous file | 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 * @implements {SDK.SDKModelObserver<!SDK.ResourceTreeModel>} 5 * @implements {SDK.SDKModelObserver<!SDK.ResourceTreeModel>}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Resources.AppManifestView = class extends UI.VBox { 8 Resources.AppManifestView = class extends UI.VBox {
9 constructor() { 9 constructor() {
10 super(true); 10 super(true);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 this._errorsSection.clearContent(); 99 this._errorsSection.clearContent();
100 this._errorsSection.element.classList.toggle('hidden', !errors.length); 100 this._errorsSection.element.classList.toggle('hidden', !errors.length);
101 for (var error of errors) { 101 for (var error of errors) {
102 this._errorsSection.appendRow().appendChild( 102 this._errorsSection.appendRow().appendChild(
103 UI.createLabel(error.message, error.critical ? 'smallicon-error' : 'sm allicon-warning')); 103 UI.createLabel(error.message, error.critical ? 'smallicon-error' : 'sm allicon-warning'));
104 } 104 }
105 105
106 if (!data) 106 if (!data)
107 return; 107 return;
108 108
109 if (data.charCodeAt(0) === 0xFEFF)
110 data = data.slice(1); // Trim the BOM as per https://tools.ietf.org/html/ rfc7159#section-8.1.
111
109 var parsedManifest = JSON.parse(data); 112 var parsedManifest = JSON.parse(data);
110 this._nameField.textContent = stringProperty('name'); 113 this._nameField.textContent = stringProperty('name');
111 this._shortNameField.textContent = stringProperty('short_name'); 114 this._shortNameField.textContent = stringProperty('short_name');
112 this._startURLField.removeChildren(); 115 this._startURLField.removeChildren();
113 var startURL = stringProperty('start_url'); 116 var startURL = stringProperty('start_url');
114 if (startURL) { 117 if (startURL) {
115 this._startURLField.appendChild(Components.Linkifier.linkifyURL( 118 this._startURLField.appendChild(Components.Linkifier.linkifyURL(
116 /** @type {string} */ (Common.ParsedURL.completeURL(url, startURL)), s tartURL)); 119 /** @type {string} */ (Common.ParsedURL.completeURL(url, startURL)), s tartURL));
117 } 120 }
118 121
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 * @param {!Common.Event} event 157 * @param {!Common.Event} event
155 */ 158 */
156 _addToHomescreen(event) { 159 _addToHomescreen(event) {
157 var target = SDK.targetManager.mainTarget(); 160 var target = SDK.targetManager.mainTarget();
158 if (target && target.hasBrowserCapability()) { 161 if (target && target.hasBrowserCapability()) {
159 target.pageAgent().requestAppBanner(); 162 target.pageAgent().requestAppBanner();
160 Common.console.show(); 163 Common.console.show();
161 } 164 }
162 } 165 }
163 }; 166 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698