Ignore:
Timestamp:
Sep 17, 2012, 3:47:37 PM (13 years ago)
Author:
[email protected]
Message:

We don't have a bad enough time if an object's prototype chain crosses global objects
https://bugs.webkit.org/show_bug.cgi?id=96962

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • runtime/JSGlobalObject.cpp:

(JSC):

LayoutTests:

  • fast/js/cross-frame-really-bad-time-expected.txt: Added.
  • fast/js/cross-frame-really-bad-time-with-proto-expected.txt: Added.
  • fast/js/cross-frame-really-bad-time-with-proto.html: Added.
  • fast/js/cross-frame-really-bad-time.html: Added.
  • fast/js/script-tests/cross-frame-really-bad-time-with-proto.js: Added.

(foo):
(evil):
(bar):
(done):

  • fast/js/script-tests/cross-frame-really-bad-time.js: Added.

(Cons):
(foo):
(evil):
(bar):
(done):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r128813 r128816  
    364364   
    365365    JSObject* object = asObject(cell);
     366
     367    // Run this filter first, since it's cheap, and ought to filter out a lot of objects.
     368    if (!hasBrokenIndexing(object))
     369        return;
    366370   
    367371    // We only want to have a bad time in the affected global object, not in the entire
    368     // VM.
    369     if (object->unwrappedGlobalObject() != m_globalObject)
    370         return;
    371    
    372     if (!hasBrokenIndexing(object))
     372    // VM. But we have to be careful, since there may be objects that claim to belong to
     373    // a different global object that has prototypes from our global object.
     374    bool foundGlobalObject = false;
     375    for (JSObject* current = object; ;) {
     376        if (current->unwrappedGlobalObject() == m_globalObject) {
     377            foundGlobalObject = true;
     378            break;
     379        }
     380       
     381        JSValue prototypeValue = current->prototype();
     382        if (prototypeValue.isNull())
     383            break;
     384        current = asObject(prototypeValue);
     385    }
     386    if (!foundGlobalObject)
    373387        return;
    374388   
Note: See TracChangeset for help on using the changeset viewer.