Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1308723003: DOMWindow::navigator should return navigator w/o frame when detached. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/serviceworker/chromium/frame-removed.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 { 654 {
655 if (!isCurrentlyDisplayedInFrame()) 655 if (!isCurrentlyDisplayedInFrame())
656 return nullptr; 656 return nullptr;
657 if (!m_applicationCache) 657 if (!m_applicationCache)
658 m_applicationCache = ApplicationCache::create(frame()); 658 m_applicationCache = ApplicationCache::create(frame());
659 return m_applicationCache.get(); 659 return m_applicationCache.get();
660 } 660 }
661 661
662 Navigator* LocalDOMWindow::navigator() const 662 Navigator* LocalDOMWindow::navigator() const
663 { 663 {
664 if (!isCurrentlyDisplayedInFrame() && (!m_navigator || m_navigator->frame()) ) {
665 // We return a navigator with null frame instead of returning null
666 // pointer as other functions do, in order to allow users to access
667 // functions such as navigator.product.
668 m_navigator = Navigator::create(nullptr);
669 }
664 if (!m_navigator) 670 if (!m_navigator)
665 m_navigator = Navigator::create(frame()); 671 m_navigator = Navigator::create(frame());
672 // As described above, when not dispayed in the frame, the returning
673 // navigator should not be associated with the frame.
674 ASSERT(isCurrentlyDisplayedInFrame() || !m_navigator->frame());
666 return m_navigator.get(); 675 return m_navigator.get();
667 } 676 }
668 677
669 void LocalDOMWindow::schedulePostMessage(PassRefPtrWillBeRawPtr<MessageEvent> ev ent, LocalDOMWindow* source, SecurityOrigin* target, PassRefPtrWillBeRawPtr<Scri ptCallStack> stackTrace) 678 void LocalDOMWindow::schedulePostMessage(PassRefPtrWillBeRawPtr<MessageEvent> ev ent, LocalDOMWindow* source, SecurityOrigin* target, PassRefPtrWillBeRawPtr<Scri ptCallStack> stackTrace)
670 { 679 {
671 // Schedule the message. 680 // Schedule the message.
672 OwnPtrWillBeRawPtr<PostMessageTimer> timer = adoptPtrWillBeNoop(new PostMess ageTimer(*this, event, source, target, stackTrace, UserGestureIndicator::current Token())); 681 OwnPtrWillBeRawPtr<PostMessageTimer> timer = adoptPtrWillBeNoop(new PostMess ageTimer(*this, event, source, target, stackTrace, UserGestureIndicator::current Token()));
673 timer->startOneShot(0, FROM_HERE); 682 timer->startOneShot(0, FROM_HERE);
674 timer->suspendIfNeeded(); 683 timer->suspendIfNeeded();
675 m_postMessageTimers.add(timer.release()); 684 m_postMessageTimers.add(timer.release());
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 DOMWindow::trace(visitor); 1496 DOMWindow::trace(visitor);
1488 DOMWindowLifecycleNotifier::trace(visitor); 1497 DOMWindowLifecycleNotifier::trace(visitor);
1489 } 1498 }
1490 1499
1491 LocalFrame* LocalDOMWindow::frame() const 1500 LocalFrame* LocalDOMWindow::frame() const
1492 { 1501 {
1493 return m_frameObserver->frame(); 1502 return m_frameObserver->frame();
1494 } 1503 }
1495 1504
1496 } // namespace blink 1505 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/chromium/frame-removed.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698