OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void resetInternalsObject(v8::Local<v8::Context> context) | 61 void resetInternalsObject(v8::Local<v8::Context> context) |
62 { | 62 { |
63 // This can happen if JavaScript is disabled in the main frame. | 63 // This can happen if JavaScript is disabled in the main frame. |
64 if (context.IsEmpty()) | 64 if (context.IsEmpty()) |
65 return; | 65 return; |
66 | 66 |
67 ScriptState* scriptState = ScriptState::from(context); | 67 ScriptState* scriptState = ScriptState::from(context); |
68 ScriptState::Scope scope(scriptState); | 68 ScriptState::Scope scope(scriptState); |
69 Page* page = toDocument(scriptState->executionContext())->frame()->page(); | 69 Document* document = toDocument(scriptState->executionContext()); |
| 70 ASSERT(document); |
| 71 LocalFrame* frame = document->frame(); |
| 72 // Should the document have been detached, the page is assumed being destroy
ed (=> no reset required.) |
| 73 if (!frame) |
| 74 return; |
| 75 Page* page = frame->page(); |
70 ASSERT(page); | 76 ASSERT(page); |
71 Internals::resetToConsistentState(page); | 77 Internals::resetToConsistentState(page); |
72 InternalSettings::from(*page)->resetToConsistentState(); | 78 InternalSettings::from(*page)->resetToConsistentState(); |
73 } | 79 } |
74 | 80 |
75 } | 81 } |
OLD | NEW |