Source/WebCore/ChangeLog

 12012-02-06 Erik Arvidsson <arv@chromium.org>
 2
 3 V8 wrappers for TextTrack and TextTrackCue should not be collected on event dispatch and when parent/owner are still reachable
 4 https://bugs.webkit.org/show_bug.cgi?id=73865
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add special handling for HTMLMediaElement and TextTrack to add implicit references to the items in the
 9 textTracks and cues collections respectively.
 10
 11 Covered by existing tests.
 12
 13 * Target.pri:
 14 * UseV8.cmake:
 15 * WebCore.gypi:
 16 * bindings/scripts/CodeGeneratorV8.pm:
 17 (HasCustomToV8Implementation): Needs custom toV8 for TextTrackList to add reference from the HTMLMediaElement to the TextTrackList.
 18 * bindings/v8/V8GCController.cpp:
 19 (WebCore::GrouperVisitor::visitDOMWrapper):
 20 (GrouperVisitor):
 21 (WebCore::GrouperVisitor::appendToGrouperList): Extracted into a method.
 22 * html/TextTrack.idl:
 23 * html/TextTrackCue.idl:
 24
1252012-01-27 Ken Buchanan <kenrb@chromium.org>
226
327 Crash in updateFirstLetter() from unnecessary anonymous block

Source/WebCore/Target.pri

@@v8 {
207207 bindings/v8/custom/V8StorageCustom.cpp \
208208 bindings/v8/custom/V8StyleSheetCustom.cpp \
209209 bindings/v8/custom/V8StyleSheetListCustom.cpp \
 210 bindings/v8/custom/V8TextTrackListCustom.cpp \
210211 bindings/v8/custom/V8WebKitAnimationCustom.cpp \
211212 bindings/v8/custom/V8WebKitMutationObserverCustom.cpp \
212213 bindings/v8/custom/V8WebKitPointConstructor.cpp \

Source/WebCore/UseV8.cmake

@@LIST(APPEND WebCore_SOURCES
143143 bindings/v8/custom/V8StorageCustom.cpp
144144 bindings/v8/custom/V8StyleSheetCustom.cpp
145145 bindings/v8/custom/V8StyleSheetListCustom.cpp
 146 bindings/v8/custom/V8TextTrackListCustom.cpp
146147 bindings/v8/custom/V8Uint16ArrayCustom.cpp
147148 bindings/v8/custom/V8Uint32ArrayCustom.cpp
148149 bindings/v8/custom/V8Uint8ArrayCustom.cpp

Source/WebCore/WebCore.gypi

18911891 'bindings/v8/custom/V8StorageCustom.cpp',
18921892 'bindings/v8/custom/V8StyleSheetCustom.cpp',
18931893 'bindings/v8/custom/V8StyleSheetListCustom.cpp',
 1894 'bindings/v8/custom/V8TextTrackListCustom.cpp',
18941895 'bindings/v8/custom/V8TrackEventCustom.cpp',
18951896 'bindings/v8/custom/V8Uint16ArrayCustom.cpp',
18961897 'bindings/v8/custom/V8Uint32ArrayCustom.cpp',

Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

@@sub HasCustomToV8Implementation {
31533153 return 1 if $interfaceName eq "SVGElement";
31543154 return 1 if $interfaceName eq "ScriptProfile";
31553155 return 1 if $interfaceName eq "ScriptProfileNode";
 3156 return 1 if $interfaceName eq "TextTrackList";
31563157 return 1 if $interfaceName eq "WorkerContext";
31573158 # We don't generate a custom converter (but JSC does) for the following:
31583159 return 0 if $interfaceName eq "AbstractWorker";

Source/WebCore/bindings/v8/V8GCController.cpp

3535#include "Attr.h"
3636#include "DOMDataStore.h"
3737#include "DOMImplementation.h"
 38#include "Element.h"
3839#include "HTMLImageElement.h"
 40#include "HTMLMediaElement.h"
3941#include "HTMLNames.h"
4042#include "MessagePort.h"
4143#include "PlatformSupport.h"
4244#include "RetainedDOMInfo.h"
4345#include "RetainedObjectInfo.h"
 46#include "TextTrack.h"
 47#include "TextTrackCueList.h"
 48#include "TextTrackList.h"
4449#include "V8Binding.h"
4550#include "V8CSSRule.h"
4651#include "V8CSSRuleList.h"

4954#include "V8MessagePort.h"
5055#include "V8StyleSheet.h"
5156#include "V8StyleSheetList.h"
 57#include "V8TextTrack.h"
 58#include "V8TextTrackCueList.h"
 59#include "V8TextTrackList.h"
5260#include "WrapperTypeInfo.h"
5361
5462#include <algorithm>

@@public:
314322 void visitDOMWrapper(DOMDataStore* store, Node* node, v8::Persistent<v8::Object> wrapper)
315323 {
316324 if (node->hasEventListeners()) {
317  Vector<v8::Persistent<v8::Value> > listeners;
 325 Vector<v8::Persistent<v8::Value> > wrappers;
318326 EventListenerIterator iterator(node);
319327 while (EventListener* listener = iterator.nextListener()) {
320328 if (listener->type() != EventListener::JSEventListenerType)

@@public:
322330 V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener);
323331 if (!v8listener->hasExistingListenerObject())
324332 continue;
325  listeners.append(v8listener->existingListenerObjectPersistentHandle());
 333 wrappers.append(v8listener->existingListenerObjectPersistentHandle());
326334 }
327  if (!listeners.isEmpty())
328  v8::V8::AddImplicitReferences(wrapper, listeners.data(), listeners.size());
 335 if (!wrappers.isEmpty())
 336 v8::V8::AddImplicitReferences(wrapper, wrappers.data(), wrappers.size());
329337 }
330338
331  GroupId groupId = calculateGroupId(node);
332  if (!groupId)
333  return;
334  m_grouper.append(GrouperItem(groupId, wrapper));
 339#if ENABLE(VIDEO_TRACK)
 340 if (node->isElementNode() && static_cast<Element*>(node)->isMediaElement()) {
 341 HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(node);
 342 TextTrackList* textTrackList = mediaElement->textTracks();
 343
 344 Vector<v8::Persistent<v8::Value> > wrappers;
 345 for (unsigned i = 0; i < textTrackList->length(); ++i) {
 346 TextTrack* textTrack = textTrackList->item(i);
 347 v8::Persistent<v8::Object> wrapper = getDOMObjectMap().get(textTrack);
 348 if (!wrapper.IsEmpty())
 349 wrappers.append(wrapper);
 350 }
 351
 352 if (!wrappers.isEmpty())
 353 v8::V8::AddImplicitReferences(wrapper, wrappers.data(), wrappers.size());
 354 }
 355#endif
 356
 357 appendToGrouperList(node, wrapper);
335358 }
336359
337360 void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
338361 {
 362#if ENABLE(VIDEO_TRACK)
 363 WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(wrapper);
 364 if (type == &V8TextTrack::info)
 365 visitDOMWrapper(store, static_cast<TextTrack*>(object), wrapper);
 366#endif
339367 }
340368
341369 void applyGrouping()

@@public:
380408 }
381409
382410private:
 411
 412#if ENABLE(VIDEO_TRACK)
 413 void visitDOMWrapper(DOMDataStore* store, TextTrack* textTrack, v8::Persistent<v8::Object> wrapper)
 414 {
 415 HTMLMediaElement* mediaElement = textTrack->mediaElement();
 416 if (!mediaElement)
 417 return;
 418
 419 Vector<v8::Persistent<v8::Value> > wrappers;
 420 TextTrackCueList* cues = textTrack->cues();
 421 if (cues) {
 422 for (unsigned i = 0; i < cues->length(); ++i) {
 423 TextTrackCue* cue = cues->item(i);
 424 v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(cue);
 425 if (!wrapper.IsEmpty())
 426 wrappers.append(wrapper);
 427 }
 428
 429 if (!wrappers.isEmpty())
 430 v8::V8::AddImplicitReferences(wrapper, wrappers.data(), wrappers.size());
 431 }
 432
 433 appendToGrouperList(mediaElement, wrapper);
 434 }
 435#endif
 436
 437 void appendToGrouperList(Node* node, v8::Persistent<v8::Object> wrapper)
 438 {
 439 GroupId groupId = calculateGroupId(node);
 440 if (!groupId)
 441 return;
 442 m_grouper.append(GrouperItem(groupId, wrapper));
 443 }
 444
383445 GrouperList m_grouper;
384446};
385447

Source/WebCore/html/TextTrack.idl

@@module html {
3030 EnabledAtRuntime=webkitVideoTrack,
3131 EventTarget,
3232 CustomMarkFunction,
33  CustomIsReachable
 33 CustomIsReachable,
 34 V8DependentLifetime
3435 ] TextTrack {
3536 readonly attribute DOMString kind;
3637 readonly attribute DOMString label;

Source/WebCore/html/TextTrackCue.idl

@@module html {
3333 CallWith=ScriptExecutionContext,
3434 EventTarget,
3535 CustomMarkFunction,
36  CustomIsReachable
 36 CustomIsReachable,
 37 V8DependentLifetime
3738 ] TextTrackCue {
3839 readonly attribute TextTrack track;
3940

LayoutTests/ChangeLog

 12012-02-06 Erik Arvidsson <arv@chromium.org>
 2
 3 V8 wrappers for TextTrack and TextTrackCue should not be collected on event dispatch and when parent/owner are still reachable
 4 https://bugs.webkit.org/show_bug.cgi?id=73865
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * platform/chromium/test_expectations.txt:
 9
1102012-01-27 Ken Buchanan <kenrb@chromium.org>
211
312 Crash in updateFirstLetter() from unnecessary anonymous block

LayoutTests/platform/chromium/test_expectations.txt

@@BUG_SENORBLANCO GPU : fast/canvas/canvas-transforms-fillRect-shadow.html = TEXT
35863586
35873587BUGWK66953 : transitions/default-timing-function.html = PASS FAIL
35883588
3589 BUGWK73865 : media/track/tracklist-is-reachable.html = TEXT CRASH
3590 BUGWK73865 : media/track/text-track-cue-is-reachable.html = TEXT CRASH
3591 BUGWK73865 : media/track/text-track-is-reachable.html = TEXT CRASH
3592 
35933589// use Skia to draw vertical text directly instead of text-on-path
35943590BUG_CARYCLARK MAC CPU : editing/selection/vertical-lr-ltr-extend-line-backward-br.html = IMAGE
35953591BUG_CARYCLARK MAC CPU : editing/selection/vertical-lr-ltr-extend-line-forward-br.html = IMAGE