Commit a9cf2dc7 authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Remove SecurityOrigin* param from StyleSheetContents::ParseAuthorStyleSheet

It's unused, and a caller is null-derefing try to provide it.

Bug: 1103072
Test: http/tests/css/stylesheet-load-complete-in-detached-iframe-crash.html
Change-Id: I21e51697f8df31f08df93b3fa9ee09ef739d9f7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2287915
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786589}
parent 30ac1c38
...@@ -90,11 +90,7 @@ void StyleRuleImport::NotifyFinished(Resource* resource) { ...@@ -90,11 +90,7 @@ void StyleRuleImport::NotifyFinished(Resource* resource) {
style_sheet_ = MakeGarbageCollected<StyleSheetContents>( style_sheet_ = MakeGarbageCollected<StyleSheetContents>(
context, cached_style_sheet->Url(), this); context, cached_style_sheet->Url(), this);
style_sheet_->ParseAuthorStyleSheet(cached_style_sheet);
auto* origin = document && document->GetExecutionContext()
? document->GetExecutionContext()->GetSecurityOrigin()
: nullptr;
style_sheet_->ParseAuthorStyleSheet(cached_style_sheet, origin);
loading_ = false; loading_ = false;
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
namespace blink { namespace blink {
...@@ -323,8 +322,7 @@ const AtomicString& StyleSheetContents::NamespaceURIFromPrefix( ...@@ -323,8 +322,7 @@ const AtomicString& StyleSheetContents::NamespaceURIFromPrefix(
} }
void StyleSheetContents::ParseAuthorStyleSheet( void StyleSheetContents::ParseAuthorStyleSheet(
const CSSStyleSheetResource* cached_style_sheet, const CSSStyleSheetResource* cached_style_sheet) {
const SecurityOrigin* security_origin) {
TRACE_EVENT1( TRACE_EVENT1(
"blink,devtools.timeline", "ParseAuthorStyleSheet", "data", "blink,devtools.timeline", "ParseAuthorStyleSheet", "data",
inspector_parse_author_style_sheet_event::Data(cached_style_sheet)); inspector_parse_author_style_sheet_event::Data(cached_style_sheet));
......
...@@ -40,7 +40,6 @@ class CSSStyleSheet; ...@@ -40,7 +40,6 @@ class CSSStyleSheet;
class CSSStyleSheetResource; class CSSStyleSheetResource;
class Document; class Document;
class Node; class Node;
class SecurityOrigin;
class StyleRuleBase; class StyleRuleBase;
class StyleRuleFontFace; class StyleRuleFontFace;
class StyleRuleImport; class StyleRuleImport;
...@@ -66,8 +65,7 @@ class CORE_EXPORT StyleSheetContents final ...@@ -66,8 +65,7 @@ class CORE_EXPORT StyleSheetContents final
const AtomicString& DefaultNamespace() const { return default_namespace_; } const AtomicString& DefaultNamespace() const { return default_namespace_; }
const AtomicString& NamespaceURIFromPrefix(const AtomicString& prefix) const; const AtomicString& NamespaceURIFromPrefix(const AtomicString& prefix) const;
void ParseAuthorStyleSheet(const CSSStyleSheetResource*, void ParseAuthorStyleSheet(const CSSStyleSheetResource*);
const SecurityOrigin*);
ParseSheetResult ParseString(const String&, bool allow_import_rules = true); ParseSheetResult ParseString(const String&, bool allow_import_rules = true);
ParseSheetResult ParseStringAtPosition(const String&, ParseSheetResult ParseStringAtPosition(const String&,
const TextPosition&, const TextPosition&,
......
...@@ -121,8 +121,7 @@ void LinkStyle::NotifyFinished(Resource* resource) { ...@@ -121,8 +121,7 @@ void LinkStyle::NotifyFinished(Resource* resource) {
if (owner_->IsInDocumentTree()) if (owner_->IsInDocumentTree())
SetSheetTitle(owner_->title()); SetSheetTitle(owner_->title());
style_sheet->ParseAuthorStyleSheet( style_sheet->ParseAuthorStyleSheet(cached_style_sheet);
cached_style_sheet, GetExecutionContext()->GetSecurityOrigin());
loading_ = false; loading_ = false;
style_sheet->NotifyLoadedSheet(cached_style_sheet); style_sheet->NotifyLoadedSheet(cached_style_sheet);
......
<head>
<link rel="stylesheet" type="text/css" href="does-not-exist.css">
</head>
<body>
<iframe id=i></iframe>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpChildFrames();
}
document.body.appendChild(document.head);
i.contentDocument.body.appendChild(document.body);
console.log("PASS if no crash.");
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment