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

Side by Side Diff: java/org/chromium/distiller/DomUtil.java

Issue 1386363003: Fix crashes on iOS related to using window.performance and reading window.location.href in a UIWebV… (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: Fix crashes on iOS related to using window.performance and reading window.location.href in a UIWebV… Created 5 years, 2 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 | « java/org/chromium/distiller/DomDistiller.java ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 package org.chromium.distiller; 5 package org.chromium.distiller;
6 6
7 import com.google.gwt.core.client.JsArray; 7 import com.google.gwt.core.client.JsArray;
8 import com.google.gwt.core.client.JsArrayString; 8 import com.google.gwt.core.client.JsArrayString;
9 import com.google.gwt.dom.client.AnchorElement; 9 import com.google.gwt.dom.client.AnchorElement;
10 import com.google.gwt.dom.client.Document; 10 import com.google.gwt.dom.client.Document;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 /* 105 /*
106 * We want to use jsni for direct access to javascript's innerText. This av oids GWT's 106 * We want to use jsni for direct access to javascript's innerText. This av oids GWT's
107 * implementation of Element::getInnerText(), which is intentionally differe nt to mimic an old 107 * implementation of Element::getInnerText(), which is intentionally differe nt to mimic an old
108 * IE behaviour, which returns text within <script> tags. 108 * IE behaviour, which returns text within <script> tags.
109 */ 109 */
110 public static native String getInnerText(Node node) /*-{ 110 public static native String getInnerText(Node node) /*-{
111 return node.innerText; 111 return node.innerText;
112 }-*/; 112 }-*/;
113 113
114 public static native double getTime() /*-{ 114 public static native double getTime() /*-{
115 // window.performance is unavailable in Gwt's dev environment. 115 // window.performance is unavailable in Gwt's dev environment and even r eferencing it on iOS
116 if (window.performance) { 116 // causes a crash.
117 if ((typeof distiller_on_ios === 'undefined' || !distiller_on_ios) && wi ndow.performance) {
117 return window.performance.now(); 118 return window.performance.now();
118 } 119 }
119 return Date.now(); 120 return Date.now();
120 }-*/; 121 }-*/;
121 122
122 /** 123 /**
123 * Use jsni for direct access to javascript's textContent. textContent is d ifferent from 124 * Use jsni for direct access to javascript's textContent. textContent is d ifferent from
124 * innerText (see http://www.kellegous.com/j/2013/02/27/innertext-vs-textcon tent): 125 * innerText (see http://www.kellegous.com/j/2013/02/27/innertext-vs-textcon tent):
125 * - textContent is the raw textual content, doesn't require layout, and is basically a 126 * - textContent is the raw textual content, doesn't require layout, and is basically a
126 * concatenation of the values of all text nodes within a subtree. 127 * concatenation of the values of all text nodes within a subtree.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 }-*/; 394 }-*/;
394 395
395 public static native Document createHTMLDocument(Document doc) /*-{ 396 public static native Document createHTMLDocument(Document doc) /*-{
396 return doc.implementation.createHTMLDocument(); 397 return doc.implementation.createHTMLDocument();
397 }-*/; 398 }-*/;
398 399
399 public static native Element getFirstElementChild(Document document) /*-{ 400 public static native Element getFirstElementChild(Document document) /*-{
400 return document.firstElementChild; 401 return document.firstElementChild;
401 }-*/; 402 }-*/;
402 } 403 }
OLDNEW
« no previous file with comments | « java/org/chromium/distiller/DomDistiller.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698