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: java/org/chromium/distiller/DomDistiller.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 | « no previous file | java/org/chromium/distiller/DomUtil.java » ('j') | 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 org.chromium.distiller.proto.DomDistillerProtos; 7 import org.chromium.distiller.proto.DomDistillerProtos;
8 import org.chromium.distiller.proto.DomDistillerProtos.DebugInfo; 8 import org.chromium.distiller.proto.DomDistillerProtos.DebugInfo;
9 import org.chromium.distiller.proto.DomDistillerProtos.TimingInfo; 9 import org.chromium.distiller.proto.DomDistillerProtos.TimingInfo;
10 import org.chromium.distiller.DomUtil; 10 import org.chromium.distiller.DomUtil;
(...skipping 29 matching lines...) Expand all
40 DomDistillerProtos.DistilledContent content = DomDistillerProtos.Distill edContent.create(); 40 DomDistillerProtos.DistilledContent content = DomDistillerProtos.Distill edContent.create();
41 boolean textOnly = options.hasExtractTextOnly() && options.getExtractTex tOnly(); 41 boolean textOnly = options.hasExtractTextOnly() && options.getExtractTex tOnly();
42 content.setHtml(contentExtractor.extractContent(textOnly)); 42 content.setHtml(contentExtractor.extractContent(textOnly));
43 result.setDistilledContent(content); 43 result.setDistilledContent(content);
44 result.setTextDirection(contentExtractor.getTextDirection()); 44 result.setTextDirection(contentExtractor.getTextDirection());
45 45
46 for (String url : contentExtractor.getImageUrls()) { 46 for (String url : contentExtractor.getImageUrls()) {
47 result.addContentImages().setUrl(url); 47 result.addContentImages().setUrl(url);
48 } 48 }
49 49
50 String original_url = options.hasOriginalUrl() ? options.getOriginalUrl( ) : Window.Location.getHref(); 50 // iOS doesn't support reading window.location.href, so we use document. URL instead.
51 String original_url =
52 options.hasOriginalUrl() ? options.getOriginalUrl() : Document.g et().getURL();
51 TimingInfo timingInfo = contentExtractor.getTimingInfo(); 53 TimingInfo timingInfo = contentExtractor.getTimingInfo();
52 double stPaging = DomUtil.getTime(); 54 double stPaging = DomUtil.getTime();
53 result.setPaginationInfo(PagingLinksFinder.getPaginationInfo(original_ur l)); 55 result.setPaginationInfo(PagingLinksFinder.getPaginationInfo(original_ur l));
54 LogUtil.addTimingInfo(stPaging, timingInfo, "Pagination"); 56 LogUtil.addTimingInfo(stPaging, timingInfo, "Pagination");
55 result.setMarkupInfo(contentExtractor.getMarkupParser().getMarkupInfo()) ; 57 result.setMarkupInfo(contentExtractor.getMarkupParser().getMarkupInfo()) ;
56 timingInfo.setTotalTime(DomUtil.getTime() - startTime); 58 timingInfo.setTotalTime(DomUtil.getTime() - startTime);
57 result.setTimingInfo(timingInfo); 59 result.setTimingInfo(timingInfo);
58 result.setStatisticsInfo(contentExtractor.getStatisticsInfo()); 60 result.setStatisticsInfo(contentExtractor.getStatisticsInfo());
59 DebugInfo debugInfo = DebugInfo.create(); 61 DebugInfo debugInfo = DebugInfo.create();
60 debugInfo.setLog(LogUtil.getAndClearLog()); 62 debugInfo.setLog(LogUtil.getAndClearLog());
61 result.setDebugInfo(debugInfo); 63 result.setDebugInfo(debugInfo);
62 return result; 64 return result;
63 } 65 }
64 } 66 }
OLDNEW
« no previous file with comments | « no previous file | java/org/chromium/distiller/DomUtil.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698