| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Applies DomDistillerJs to the content of the page and returns a | |
| 6 // DomDistillerResults (as a javascript object/dict). | |
| 7 (function() { | |
| 8 try { | |
| 9 // The generated domdistiller.js accesses the window object only explicitly | |
| 10 // via the window name. So, we create a new object with the normal window | |
| 11 // object as its prototype and initialize the domdistiller.js with that new | |
| 12 // context so that it doesn't change the real window object. | |
| 13 function initialize(window) { | |
| 14 // This include will be processed at build time by grit. | |
| 15 <include src="../../../../third_party/dom_distiller_js/package/js/domdisti
ller.js"/> | |
| 16 } | |
| 17 var context = Object.create(window); | |
| 18 context.setTimeout = function() {}; | |
| 19 context.clearTimeout = function() {}; | |
| 20 initialize(context); | |
| 21 | |
| 22 // The OPTIONS placeholder will be replaced with the DomDistillerOptions at | |
| 23 // runtime. | |
| 24 var distiller = context.org.chromium.distiller.DomDistiller; | |
| 25 var res = distiller.applyWithOptions($$OPTIONS); | |
| 26 return res; | |
| 27 } catch (e) { | |
| 28 window.console.error("Error during distillation: " + e); | |
| 29 if (e.stack != undefined) window.console.error(e.stack); | |
| 30 } | |
| 31 return undefined; | |
| 32 })() | |
| OLD | NEW |