Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: third_party/WebKit/Source/core/dom/ScriptLoaderClient.h

Issue 2723793002: De-Element ScriptLoader (Closed)
Patch Set: De-Element ScriptLoader Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ScriptLoaderClient.h
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoaderClient.h b/third_party/WebKit/Source/core/dom/ScriptLoaderClient.h
index 3e9fd7ed9ac79467943a03de6331b91203eb7faa..9f71e0b2555ebd1e8eb223b78f4c864f52090fa4 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoaderClient.h
+++ b/third_party/WebKit/Source/core/dom/ScriptLoaderClient.h
@@ -22,30 +22,65 @@
#define ScriptLoaderClient_h
#include "core/CoreExport.h"
+#include "platform/heap/Handle.h"
+#include "platform/heap/Heap.h"
#include "wtf/text/AtomicString.h"
+#include "wtf/text/TextPosition.h"
#include "wtf/text/WTFString.h"
namespace blink {
+class Document;
+class Element;
+class HTMLScriptElementOrSVGScriptElement;
+class ScriptLoader;
-class CORE_EXPORT ScriptLoaderClient {
+class CORE_EXPORT ScriptLoaderClient : public GarbageCollectedMixin {
Nate Chapin 2017/02/28 21:39:29 I'm not thrilled with how large this interface end
public:
virtual ~ScriptLoaderClient() {}
- virtual void dispatchLoadEvent() = 0;
+ static ScriptLoaderClient* fromElementIfPossible(Element*);
- virtual String sourceAttributeValue() const = 0;
- virtual String charsetAttributeValue() const = 0;
- virtual String typeAttributeValue() const = 0;
- virtual String languageAttributeValue() const = 0;
- virtual String forAttributeValue() const = 0;
- virtual String eventAttributeValue() const = 0;
- virtual bool asyncAttributeValue() const = 0;
- virtual bool deferAttributeValue() const = 0;
- virtual bool hasSourceAttribute() const = 0;
+ virtual void dispatchLoadEvent() {}
+ virtual void dispatchErrorEvent() {}
+
+ virtual String sourceAttributeValue() const { return String(); }
Nate Chapin 2017/02/28 21:39:29 I don't know how good/bad it is to have the defaul
hiroshige 2017/03/01 00:58:14 I think making these all methods all abstract is b
Nate Chapin 2017/03/01 21:34:59 I had been thinking that there are some methods wh
hiroshige 2017/03/06 22:54:03 I think it's better to make these abstract, becaus
kouhei (in TOK) 2017/03/15 03:31:40 +1 on making this abstract
Nate Chapin 2017/03/16 20:15:09 Done.
+ virtual String charsetAttributeValue() const { return String(); }
+ virtual String typeAttributeValue() const { return String(); }
hiroshige 2017/03/01 00:58:14 Can we split these methods into subgroups for read
Nate Chapin 2017/03/01 21:34:59 Done.
+ virtual String languageAttributeValue() const { return String(); }
+ virtual String forAttributeValue() const { return String(); }
+ virtual String eventAttributeValue() const { return String(); }
+ virtual String crossOriginAttributeValue() const { return String(); }
+ virtual String integrityAttributeValue() const { return String(); }
+ virtual String textFromChildren() { return String(); }
+ virtual String textContent() const { return String(); }
+ virtual bool asyncAttributeValue() const { return false; }
+ virtual bool deferAttributeValue() const { return false; }
+ virtual bool hasSourceAttribute() const { return false; }
+ virtual bool isConnected() const { return false; }
+ virtual bool hasChildren() const { return false; }
+ virtual bool isNonceableElement() const { return false; }
+ virtual bool allowInlineScriptForCSP(const AtomicString& nonce,
hiroshige 2017/03/01 00:58:14 nit: Can this be a const method?
Nate Chapin 2017/03/01 21:34:59 It calls a CSP function that takes a non-const Ele
hiroshige 2017/03/06 22:54:03 Oh, I see. (and I've just found the ContentSecurit
+ const WTF::OrdinalNumber&,
+ const String& scriptContent) = 0;
+ virtual AtomicString initiatorName() const { return AtomicString(); }
+ virtual Document& document() const = 0;
+ virtual void setScriptElementForBinding(
+ HTMLScriptElementOrSVGScriptElement&) {}
+
+ ScriptLoader* loader() const { return m_loader.get(); }
AtomicString nonce() const { return m_nonce; }
void setNonce(const String& nonce) { m_nonce = AtomicString(nonce); }
+ DECLARE_VIRTUAL_TRACE();
+
+ protected:
+ void initializeScriptLoader(bool parserInserted,
+ bool alreadyStarted,
+ bool createdDuringDocumentWrite);
+
+ Member<ScriptLoader> m_loader;
+
private:
AtomicString m_nonce;
};

Powered by Google App Engine
This is Rietveld 408576698