Hm, I am not sure anymore why I removed the html part from DDG in #19898 (moved), maybe mcs/brade have some memory about that? But my patch is adding it back again as it solves this bug (see bug_27507 (https://gitweb.torproject.org/user/gk/torbutton.git/commit/?h=bug_27507&id=ea6f3ec3ec41a953827e103a0f68f3d2d4fc237a) in my public Torbutton repo). Moreover, it solves the issue that a user on #tor had today, that just hitting the arrow in the search bar without entering any search term would get a white DDG page (which is arguably a DDG bug).
Trac: Status: new to needs_review Cc: arthuredelstein to arthuredelstein, mcs, brade Keywords: N/Adeleted, TorBrowserTeam201809R added
Your patch looks fine, but I wonder if we should ask DDG to fix their bug instead.
Actually, I should have read the comments in this bug closer. h1n1 is right I think. The issue only occurs once you set the slider to "Safest" and start using DuckDuckGo.