diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/frame/deprecation.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/frame/deprecation.cc | 138 |
1 files changed, 84 insertions, 54 deletions
diff --git a/chromium/third_party/blink/renderer/core/frame/deprecation.cc b/chromium/third_party/blink/renderer/core/frame/deprecation.cc index 5c501037a85..fbe82e389d1 100644 --- a/chromium/third_party/blink/renderer/core/frame/deprecation.cc +++ b/chromium/third_party/blink/renderer/core/frame/deprecation.cc @@ -10,7 +10,7 @@ #include "third_party/blink/public/platform/reporting.mojom-blink.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/frame/deprecation_report.h" +#include "third_party/blink/renderer/core/frame/deprecation_report_body.h" #include "third_party/blink/renderer/core/frame/frame_console.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h" @@ -182,10 +182,6 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) { "'navigator.webkitTemporaryStorage' or " "'navigator.webkitPersistentStorage'")}; - case WebFeature::kConsoleMarkTimeline: - return {"ConsoleMarkTimeline", kUnknown, - ReplacedBy("'console.markTimeline'", "'console.timeStamp'")}; - case WebFeature::kPrefixedVideoSupportsFullscreen: return {"PrefixedVideoSupportsFullscreen", kUnknown, ReplacedBy("'HTMLVideoElement.webkitSupportsFullscreen'", @@ -231,14 +227,6 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) { "<source src> with a <picture> parent is invalid and therefore " "ignored. Please use <source srcset> instead."}; - case WebFeature::kConsoleTimeline: - return {"ConsoleTimeline", kUnknown, - ReplacedBy("'console.timeline'", "'console.time'")}; - - case WebFeature::kConsoleTimelineEnd: - return {"ConsoleTimelineEnd", kUnknown, - ReplacedBy("'console.timelineEnd'", "'console.timeEnd'")}; - case WebFeature::kXMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload: return {"XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload", kUnknown, @@ -504,28 +492,22 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) { case WebFeature::kPresentationRequestStartInsecureOrigin: case WebFeature::kPresentationReceiverInsecureOrigin: return { - "PresentationInsecureOrigin", kM68, + "PresentationInsecureOrigin", kM71, String("Using the Presentation API on insecure origins is " - "deprecated and will be removed in M68. You should consider " + "deprecated and will be removed in M71. You should consider " "switching your application to a secure origin, such as " "HTTPS. See " "https://goo.gl/rStTGz for more details.")}; - case WebFeature::kPaymentRequestSupportedMethodsArray: - return {"PaymentRequestSupportedMethodsArray", kM64, - ReplacedWillBeRemoved( - "PaymentRequest's supportedMethods taking an array", - "a single string", kM64, "5177301645918208")}; - case WebFeature::kLocalCSSFileExtensionRejected: return {"LocalCSSFileExtensionRejected", kM64, String("CSS cannot be loaded from `file:` URLs unless they end " "in a `.css` file extension.")}; case WebFeature::kCreateObjectURLMediaStream: - return {"CreateObjectURLMediaStreamDeprecated", kM69, + return {"CreateObjectURLMediaStreamDeprecated", kM71, ReplacedWillBeRemoved("URL.createObjectURL with media streams", - "HTMLMediaElement.srcObject", kM69, + "HTMLMediaElement.srcObject", kM71, "5618491470118912")}; case WebFeature::kChromeLoadTimesRequestTime: @@ -556,20 +538,6 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) { "Using unescaped '#' characters in a data URI body", "'%23'", kM71, "5656049583390720")}; - case WebFeature::kImageInputTypeFormDataWithNonEmptyValue: - return {"ImageInputTypeFormDataWithNonEmptyValue", kM68, - WillBeRemoved("Extra form data if value attribute " - "is present with non-empty " - "value for <input type='image'>", - kM68, "5672688152477696")}; - - - case WebFeature::kV8Document_CreateTouchList_Method: - return {"V8Document_CreateTouchList_Method", kM69, - ReplacedWillBeRemoved("document.createTouchList", - "TouchEvent constructor", kM69, - "5668612064935936")}; - case WebFeature::kDocumentOrigin: return {"DocumentOrigin", kM70, ReplacedWillBeRemoved("document.origin", @@ -581,6 +549,41 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) { WillBeRemoved("Anonymous named getter of HTMLFrameSetElement", kM70, "5235521668251648")}; + case WebFeature::kMediaElementSourceOnOfflineContext: + return {"MediaElementAudioSourceNode", kM70, + WillBeRemoved("Creating a MediaElementAudioSourceNode on an " + "OfflineAudioContext", + kM70, "5258622686724096")}; + + case WebFeature::kMediaStreamDestinationOnOfflineContext: + return {"MediaStreamAudioDestinationNode", kM70, + WillBeRemoved("Creating a MediaStreamAudioDestinationNode on an " + "OfflineAudioContext", + kM70, "5258622686724096")}; + + case WebFeature::kMediaStreamSourceOnOfflineContext: + return { + "MediaStreamAudioSourceNode", kM70, + WillBeRemoved( + "Creating a MediaStreamAudioSourceNode on an OfflineAudioContext", + kM70, "5258622686724096")}; + + case WebFeature::kRTCDataChannelInitMaxRetransmitTime: + return {"RTCDataChannelInitMaxRetransmitTime", kM70, + ReplacedWillBeRemoved("maxRetransmitTime", "maxPacketLifeTime", + kM70, "5198350873788416")}; + + case WebFeature::kGridRowTrackPercentIndefiniteHeight: + return {"GridRowTrackPercentIndefiniteHeight", kM70, + String::Format("Percentages row tracks and gutters for " + "indefinite height grid containers will be " + "resolved against the intrinsic height instead of " + "being treated as auto and zero respectively. " + "This change will happen in %s. See " + "https://www.chromestatus.com/feature/" + "6708326821789696 for more details.", + MilestoneString(kM70))}; + // Features that aren't deprecated don't have a deprecation message. default: return {"NotDeprecated", kUnknown, ""}; @@ -593,12 +596,15 @@ namespace blink { Deprecation::Deprecation() : mute_count_(0) { css_property_deprecation_bits_.EnsureSize(numCSSPropertyIDs); + features_deprecation_bits_.EnsureSize( + static_cast<int>(WebFeature::kNumberOfFeatures)); } Deprecation::~Deprecation() = default; void Deprecation::ClearSuppression() { css_property_deprecation_bits_.ClearAll(); + features_deprecation_bits_.ClearAll(); } void Deprecation::MuteForInspector() { @@ -619,6 +625,14 @@ bool Deprecation::IsSuppressed(CSSPropertyID unresolved_property) { return css_property_deprecation_bits_.QuickGet(unresolved_property); } +void Deprecation::SetReported(WebFeature feature) { + features_deprecation_bits_.QuickSet(static_cast<int>(feature)); +} + +bool Deprecation::GetReported(WebFeature feature) const { + return features_deprecation_bits_.QuickGet(static_cast<int>(feature)); +} + void Deprecation::WarnOnDeprecatedProperties( const LocalFrame* frame, CSSPropertyID unresolved_property) { @@ -643,18 +657,16 @@ String Deprecation::DeprecationMessage(CSSPropertyID unresolved_property) { return g_empty_string; } +// TODO(loonybear): Replace CountDeprecation(LocalFrame*) by CountDeprecation( +// DocumentLoader*) eventually. void Deprecation::CountDeprecation(const LocalFrame* frame, WebFeature feature) { if (!frame) return; - Page* page = frame->GetPage(); - if (!page || page->GetDeprecation().mute_count_) - return; - - if (!page->GetUseCounter().HasRecordedMeasurement(feature)) { - page->GetUseCounter().RecordMeasurement(feature, *frame); - GenerateReport(frame, feature); - } + DocumentLoader* loader = frame->GetDocument() + ? frame->GetDocument()->Loader() + : frame->Loader().GetProvisionalDocumentLoader(); + Deprecation::CountDeprecation(loader, feature); } void Deprecation::CountDeprecation(ExecutionContext* context, @@ -671,7 +683,23 @@ void Deprecation::CountDeprecation(ExecutionContext* context, void Deprecation::CountDeprecation(const Document& document, WebFeature feature) { - Deprecation::CountDeprecation(document.GetFrame(), feature); + Deprecation::CountDeprecation(document.Loader(), feature); +} + +void Deprecation::CountDeprecation(DocumentLoader* loader, WebFeature feature) { + if (!loader) + return; + LocalFrame* frame = loader->GetFrame(); + if (!frame) + return; + Page* page = frame->GetPage(); + if (!loader || !page || page->GetDeprecation().mute_count_ || + page->GetDeprecation().GetReported(feature)) + return; + + page->GetDeprecation().SetReported(feature); + UseCounter::Count(loader, feature); + GenerateReport(frame, feature); } void Deprecation::CountDeprecationCrossOriginIframe(const LocalFrame* frame, @@ -761,24 +789,26 @@ void Deprecation::GenerateReport(const LocalFrame* frame, WebFeature feature) { // Construct the deprecation report. double removal_date = MilestoneDate(info.anticipated_removal); - DeprecationReport* body = new DeprecationReport( + DeprecationReportBody* body = new DeprecationReportBody( info.id, removal_date, info.message, SourceLocation::Capture()); Report* report = new Report("deprecation", document->Url().GetString(), body); // Send the deprecation report to any ReportingObservers. - ReportingContext* reporting_context = ReportingContext::From(document); - if (reporting_context->ObserverExists()) - reporting_context->QueueReport(report); + ReportingContext::From(document)->QueueReport(report); // Send the deprecation report to the Reporting API. mojom::blink::ReportingServiceProxyPtr service; Platform* platform = Platform::Current(); platform->GetConnector()->BindInterface(platform->GetBrowserServiceName(), &service); - service->QueueDeprecationReport(document->Url(), info.id, - WTF::Time::FromDoubleT(removal_date), - info.message, body->sourceFile(), - body->lineNumber(), body->columnNumber()); + bool is_null; + int line_number = body->lineNumber(is_null); + line_number = is_null ? 0 : line_number; + int column_number = body->columnNumber(is_null); + column_number = is_null ? 0 : column_number; + service->QueueDeprecationReport( + document->Url(), info.id, WTF::Time::FromDoubleT(removal_date), + info.message, body->sourceFile(), line_number, column_number); } // static |