Bug 120172 - Document should always have a Settings
Summary: Document should always have a Settings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-22 14:25 PDT by Andreas Kling
Modified: 2017-02-09 09:49 PST (History)
11 users (show)

See Also:


Attachments
EWS experiment (87.41 KB, patch)
2013-08-22 14:26 PDT, Andreas Kling
eflews.bot: commit-queue-
Details | Formatted Diff | Diff
Patch for EWS (65.20 KB, patch)
2017-02-04 08:05 PST, Andreas Kling
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-elcapitan (953.22 KB, application/zip)
2017-02-04 09:21 PST, Build Bot
no flags Details
Another EWSable (65.90 KB, patch)
2017-02-08 09:14 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (73.49 KB, patch)
2017-02-08 10:11 PST, Andreas Kling
koivisto: review+
Details | Formatted Diff | Diff
Patch for landing (72.99 KB, patch)
2017-02-09 09:24 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2013-08-22 14:25:40 PDT
Give Documents a steady ref on its Settings.
Comment 1 Andreas Kling 2013-08-22 14:26:03 PDT
Created attachment 209394 [details]
EWS experiment
Comment 2 WebKit Commit Bot 2013-08-22 14:29:10 PDT
Attachment 209394 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/WebCore.exp.in', u'Source/WebCore/css/CSSParser.cpp', u'Source/WebCore/css/DeprecatedStyleBuilder.cpp', u'Source/WebCore/css/StyleResolver.cpp', u'Source/WebCore/css/StyleResolver.h', u'Source/WebCore/dom/DOMImplementation.cpp', u'Source/WebCore/dom/Document.cpp', u'Source/WebCore/dom/Document.h', u'Source/WebCore/dom/DocumentStyleSheetCollection.cpp', u'Source/WebCore/dom/ScriptableDocumentParser.cpp', u'Source/WebCore/dom/ScriptedAnimationController.cpp', u'Source/WebCore/dom/make_names.pl', u'Source/WebCore/editing/InsertIntoTextNodeCommand.cpp', u'Source/WebCore/editing/markup.cpp', u'Source/WebCore/html/FTPDirectoryDocument.cpp', u'Source/WebCore/html/FTPDirectoryDocument.h', u'Source/WebCore/html/HTMLAnchorElement.cpp', u'Source/WebCore/html/HTMLAppletElement.cpp', u'Source/WebCore/html/HTMLCanvasElement.cpp', u'Source/WebCore/html/HTMLDocument.cpp', u'Source/WebCore/html/HTMLDocument.h', u'Source/WebCore/html/HTMLElement.cpp', u'Source/WebCore/html/HTMLFrameElementBase.cpp', u'Source/WebCore/html/HTMLImageLoader.cpp', u'Source/WebCore/html/HTMLMediaElement.cpp', u'Source/WebCore/html/HTMLVideoElement.cpp', u'Source/WebCore/html/HTMLViewSourceDocument.cpp', u'Source/WebCore/html/HTMLViewSourceDocument.h', u'Source/WebCore/html/ImageDocument.cpp', u'Source/WebCore/html/ImageDocument.h', u'Source/WebCore/html/MediaDocument.cpp', u'Source/WebCore/html/MediaDocument.h', u'Source/WebCore/html/PluginDocument.cpp', u'Source/WebCore/html/PluginDocument.h', u'Source/WebCore/html/TextDocument.cpp', u'Source/WebCore/html/TextDocument.h', u'Source/WebCore/html/parser/HTMLParserOptions.cpp', u'Source/WebCore/html/shadow/MediaControlElements.cpp', u'Source/WebCore/inspector/DOMPatchSupport.cpp', u'Source/WebCore/loader/DocumentWriter.cpp', u'Source/WebCore/loader/FrameLoader.cpp', u'Source/WebCore/loader/LinkLoader.cpp', u'Source/WebCore/loader/PlaceholderDocument.h', u'Source/WebCore/loader/SinkDocument.cpp', u'Source/WebCore/loader/SinkDocument.h', u'Source/WebCore/loader/cache/CachedFont.cpp', u'Source/WebCore/loader/cache/CachedSVGDocument.cpp', u'Source/WebCore/rendering/InlineTextBox.cpp', u'Source/WebCore/rendering/RenderBoxModelObject.cpp', u'Source/WebCore/rendering/RenderEmbeddedObject.cpp', u'Source/WebCore/rendering/RenderLayer.cpp', u'Source/WebCore/rendering/RenderLayerCompositor.cpp', u'Source/WebCore/rendering/RenderObject.cpp', u'Source/WebCore/rendering/RenderSearchField.cpp', u'Source/WebCore/rendering/RenderText.cpp', u'Source/WebCore/rendering/RenderTheme.cpp', u'Source/WebCore/style/StyleFontSizeFunctions.cpp', u'Source/WebCore/style/StyleResolveForDocument.cpp', u'Source/WebCore/style/StyleResolveTree.cpp', u'Source/WebCore/style/StyleResolveTree.h', u'Source/WebCore/svg/SVGDocument.cpp', u'Source/WebCore/svg/SVGDocument.h', u'Source/WebCore/svg/SVGUseElement.cpp', u'Source/WebCore/xml/XMLHttpRequest.cpp', u'Source/WebCore/xml/XSLTProcessor.cpp']" exit_code: 1
Source/WebCore/dom/DOMImplementation.cpp:374:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 63 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 EFL EWS Bot 2013-08-22 14:51:04 PDT
Comment on attachment 209394 [details]
EWS experiment

Attachment 209394 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/1545243
Comment 4 EFL EWS Bot 2013-08-22 15:04:50 PDT
Comment on attachment 209394 [details]
EWS experiment

Attachment 209394 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/1519910
Comment 5 kov's GTK+ EWS bot 2013-08-22 15:58:34 PDT
Comment on attachment 209394 [details]
EWS experiment

Attachment 209394 [details] did not pass gtk-ews (gtk):
Output: http://webkit-queues.appspot.com/results/1546096
Comment 6 Simon Fraser (smfr) 2017-02-01 12:05:57 PST
What's a steady ref?
Comment 7 Andreas Kling 2017-02-04 07:52:53 PST
I think I just wanted to add a Settings& Document::settings().
Looks like there was some trouble dealing with frameless documents.
I bet this would be easy to solve though..
Comment 8 Andreas Kling 2017-02-04 08:05:55 PST
Created attachment 300625 [details]
Patch for EWS

Quick and dirty, let's see what EWS thinks.
Comment 9 Build Bot 2017-02-04 09:21:23 PST
Comment on attachment 300625 [details]
Patch for EWS

Attachment 300625 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3004189

New failing tests:
fast/html/detach-frame-while-clicking-on-anchor-with-ping.html
Comment 10 Build Bot 2017-02-04 09:21:27 PST
Created attachment 300629 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 11 Andreas Kling 2017-02-04 09:26:03 PST
(In reply to comment #9)
> Comment on attachment 300625 [details]
> Patch for EWS
> 
> Attachment 300625 [details] did not pass mac-ews (mac):
> Output: http://webkit-queues.webkit.org/results/3004189
> 
> New failing tests:
> fast/html/detach-frame-while-clicking-on-anchor-with-ping.html

This failure is beautiful. The code assumes Document::frame() is non-null because Document::settings() was.
Comment 12 Andreas Kling 2017-02-08 09:14:14 PST
Created attachment 300912 [details]
Another EWSable
Comment 13 Andreas Kling 2017-02-08 10:11:24 PST
Created attachment 300919 [details]
Patch
Comment 14 Antti Koivisto 2017-02-09 05:02:59 PST
Comment on attachment 300919 [details]
Patch

Awesome! r=me
Comment 15 Antti Koivisto 2017-02-09 05:07:19 PST
Comment on attachment 300919 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300919&action=review

> Source/WebCore/dom/Document.h:513
> +    Settings& settings() const { return m_settings.get(); }

Could we make this 

const Settings& settings() const

and maybe have separate mutableSettings() if needed?

> Source/WebCore/page/csp/ContentSecurityPolicy.cpp:260
> +    if (Settings* settings = is<Document>(m_scriptExecutionContext) ? &downcast<Document>(*m_scriptExecutionContext).settings() : nullptr)
>          return settings->allowContentSecurityPolicySourceStarToMatchAnyProtocol();

This could be just

if (is<Document>(m_scriptExecutionContext))
   downcast<Document>(*m_scriptExecutionContext).settings().allowContentSecurityPolicySourceStarToMatchAnyProtocol();

> Source/WebCore/rendering/SimpleLineLayout.cpp:1183
> +        auto& settings = document->settings();
> +        settings.setSimpleLineLayoutEnabled(!settings.simpleLineLayoutEnabled());

Temporary is not really useful here.
Comment 16 Geoffrey Garen 2017-02-09 08:26:02 PST
Comment on attachment 300919 [details]
Patch

YES!
Comment 17 Geoffrey Garen 2017-02-09 08:26:33 PST
True fact: Dave Hyatt said we should do this 11 years ago.
Comment 18 Andreas Kling 2017-02-09 08:58:04 PST
(In reply to comment #16)
> YES!

I know right.

Okay I'm gonna land this first, and then take Antti's suggestion and make Document::settings() return a const Settings, which will require a bunch more fixes since Settings getters are non-const (huh!)
Comment 19 Andreas Kling 2017-02-09 09:24:37 PST
Created attachment 301049 [details]
Patch for landing
Comment 20 WebKit Commit Bot 2017-02-09 09:49:07 PST
Comment on attachment 301049 [details]
Patch for landing

Clearing flags on attachment: 301049

Committed r211964: <http://trac.webkit.org/changeset/211964>
Comment 21 WebKit Commit Bot 2017-02-09 09:49:14 PST
All reviewed patches have been landed.  Closing bug.