Bug 253883

Summary: [MSE] SourceBuffer.buffered should return the same object if it's not modified
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/39075

Description Jean-Yves Avenard [:jya] 2023-03-14 05:01:25 PDT
Per spec, https://w3c.github.io/media-source/#dom-sourcebuffer-buffered

Step 5,
```
5. If intersection ranges does not contain the exact same range information as the current value of this attribute, then update the current value of this attribute to intersection ranges.
6. Return the current value of this attribute.
```

The current value of this attribute should only be modified if it has changed.

However, currently a copy of the attribute is always returned:
https://searchfox.org/wubkat/rev/7a7d33c945c423639d0e625352d98c40411716f2/Source/WebCore/Modules/mediasource/SourceBuffer.cpp#123-124

```
   // 2. Return a new static normalized TimeRanges object for the media segments buffered.
    return m_private->buffered()->copy();
```

seems to be based on an old spec.
Comment 1 Radar WebKit Bug Importer 2023-03-14 05:01:50 PDT
<rdar://problem/106695698>
Comment 2 Jean-Yves Avenard [:jya] 2023-03-19 00:16:12 PDT
Origin of change in the spec was https://www.w3.org/Bugs/Public/show_bug.cgi?id=27790
Comment 3 Jean-Yves Avenard [:jya] 2023-03-19 02:02:57 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11694
Comment 4 EWS 2023-03-19 17:41:53 PDT
Committed 261848@main (f373c652ff7f): <https://commits.webkit.org/261848@main>

Reviewed commits have been landed. Closing PR #11694 and removing active labels.