| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 d->cancelAnimationFrame(id); | 1562 d->cancelAnimationFrame(id); |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 DOMWindowCSS* LocalDOMWindow::css() const | 1565 DOMWindowCSS* LocalDOMWindow::css() const |
| 1566 { | 1566 { |
| 1567 if (!m_css) | 1567 if (!m_css) |
| 1568 m_css = DOMWindowCSS::create(); | 1568 m_css = DOMWindowCSS::create(); |
| 1569 return m_css.get(); | 1569 return m_css.get(); |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 static void didAddStorageEventListener(LocalDOMWindow* window) | |
| 1573 { | |
| 1574 // Creating these blink::Storage objects informs the system that we'd like t
o receive | |
| 1575 // notifications about storage events that might be triggered in other proce
sses. Rather | |
| 1576 // than subscribe to these notifications explicitly, we subscribe to them im
plicitly to | |
| 1577 // simplify the work done by the system. | |
| 1578 window->localStorage(IGNORE_EXCEPTION); | |
| 1579 window->sessionStorage(IGNORE_EXCEPTION); | |
| 1580 } | |
| 1581 | |
| 1582 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener> listener, bool useCapture) | 1572 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener> listener, bool useCapture) |
| 1583 { | 1573 { |
| 1584 if (!EventTarget::addEventListener(eventType, listener, useCapture)) | 1574 if (!EventTarget::addEventListener(eventType, listener, useCapture)) |
| 1585 return false; | 1575 return false; |
| 1586 | 1576 |
| 1587 if (frame() && frame()->host()) | 1577 if (frame() && frame()->host()) |
| 1588 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT
ype); | 1578 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT
ype); |
| 1589 | 1579 |
| 1590 if (Document* document = this->document()) { | 1580 if (Document* document = this->document()) { |
| 1591 document->addListenerTypeIfNeeded(eventType); | 1581 document->addListenerTypeIfNeeded(eventType); |
| 1592 if (eventType == EventTypeNames::storage) | |
| 1593 didAddStorageEventListener(this); | |
| 1594 } | 1582 } |
| 1595 | 1583 |
| 1596 lifecycleNotifier().notifyAddEventListener(this, eventType); | 1584 lifecycleNotifier().notifyAddEventListener(this, eventType); |
| 1597 | 1585 |
| 1598 if (eventType == EventTypeNames::unload) { | 1586 if (eventType == EventTypeNames::unload) { |
| 1599 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); | 1587 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); |
| 1600 addUnloadEventListener(this); | 1588 addUnloadEventListener(this); |
| 1601 } else if (eventType == EventTypeNames::beforeunload) { | 1589 } else if (eventType == EventTypeNames::beforeunload) { |
| 1602 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered
); | 1590 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered
); |
| 1603 if (allowsBeforeUnloadListeners(this)) { | 1591 if (allowsBeforeUnloadListeners(this)) { |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 return m_frameObserver->frame(); | 1967 return m_frameObserver->frame(); |
| 1980 } | 1968 } |
| 1981 | 1969 |
| 1982 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1970 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
| 1983 { | 1971 { |
| 1984 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1972 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
| 1985 return v8::Handle<v8::Object>(); | 1973 return v8::Handle<v8::Object>(); |
| 1986 } | 1974 } |
| 1987 | 1975 |
| 1988 } // namespace blink | 1976 } // namespace blink |
| OLD | NEW |