How to get the dom-distiller to work in content shell.

107 views
Skip to first unread message

Vivek

unread,
Apr 4, 2023, 8:25:09 PM4/4/23
to Chromium-dev
Hi,

I am trying to get the dom distiller to work in the content shell.

I am using —enable-dom-distiller —enable-distillability-service command line args to launch the content shell.

I am following exactly the way DomDistillerService is used in chrome. I have copied chrome/browser/dom_distiller/dom_distiller_service_factory.{h,cc} and chrome/browser/dom_distiller/tab_utils.{h,cc} files into content shell dir and replaced any chrome specific code with the content shell equivalent.

I am running the following code in the shell.cc on a button click
dom_distiller::SetDistillerJavaScriptWorldId(ISOLATED_WORLD_ID_CONTENT_END);
DistillCurrentPageAndView(web_contents());

I am able to see the logs in devtools console. I have pasted a part of it below.
(for the url https://chromium.googlesource.com/chromium/src/+/HEAD/docs/contributing.md ).

DomDistiller debug level: 3
(unknown) KEEP HTML: id=, dsp=block, vis=visible, opaq=1
(unknown) SKIP HEAD: id=, dsp=none, vis=visible, opaq=1
(unknown) KEEP BODY: id=, dsp=flex, vis=visible, opaq=1
(unknown) KEEP HEADER: id=, dsp=block, vis=visible, opaq=1
2(unknown) KEEP DIV: id=, dsp=flex, vis=visible, opaq=1
(unknown) KEEP A: id=, dsp=block, vis=visible, opaq=1
(unknown) KEEP IMG: id=, dsp=inline-block, vis=visible, opaq=1
(unknown) KEEP SPAN: id=, dsp=inline, vis=visible, opaq=1
(unknown) KEEP NAV: id=, dsp=block, vis=visible, opaq=1
(unknown) KEEP UL: id=, dsp=block, vis=visible, opaq=1
(unknown) KEEP LI: id=, dsp=inline-block, vis=visible, opaq=1
(unknown) KEEP A: id=, dsp=inline, vis=visible, opaq=1

...

(unknown) [0;34m<<<<< Start >>>>>
(unknown) [0-0;tl=6;nw=2;ld=1;] [0;35mboilerplate,[1;30m[]
Chromium Docs
[1-11;tl=7;nw=16;ld=1;] [0;35mboilerplate,[1;30m[STRICTLY_NOT_CONTENT, de.l3s.boilerpipe/LI]
Home
Sitemap
Getting Started
Testing
Design Docs
Contact
Bugs
Style Guide
Markdown Syntax
Old Docs
Search

...

But at the end, the current page turns all white with no content in it.
I tried with variety of other article-like web pages as well; result is the same. But all of those do load in reader mode in “Google Chrome”.

I also don’t see much logs from dom_distiller even with --enable-logging.

- Are there any obvious things that I am missing?
- Does the tab_utils above handles the rendering of the reader mode page or do I have to do some changes for that?
- Also, what are the ways to debug this issue?

Any help is appreciated.

Thanks,
Vivek
Reply all
Reply to author
Forward
0 new messages