OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 object->SetInternalField(cacheIndex, cache); | 51 object->SetInternalField(cacheIndex, cache); |
52 } | 52 } |
53 | 53 |
54 v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache); | 54 v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache); |
55 cacheArray->Set(v8::Integer::New(cacheArray->Length()), value); | 55 cacheArray->Set(v8::Integer::New(cacheArray->Length()), value); |
56 } | 56 } |
57 | 57 |
58 void removeHiddenDependency(v8::Local<v8::Object> object, v8::Local<v8::Value> v
alue, int cacheIndex) | 58 void removeHiddenDependency(v8::Local<v8::Object> object, v8::Local<v8::Value> v
alue, int cacheIndex) |
59 { | 59 { |
60 v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex); | 60 v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex); |
61 ASSERT(cache->IsArray()); | 61 if (!cache->IsArray()) |
| 62 return; |
62 v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache); | 63 v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache); |
63 for (int i = cacheArray->Length() - 1; i >= 0; --i) { | 64 for (int i = cacheArray->Length() - 1; i >= 0; --i) { |
64 v8::Local<v8::Value> cached = cacheArray->Get(v8::Integer::New(i)); | 65 v8::Local<v8::Value> cached = cacheArray->Get(v8::Integer::New(i)); |
65 if (cached->StrictEquals(value)) { | 66 if (cached->StrictEquals(value)) { |
66 cacheArray->Delete(i); | 67 cacheArray->Delete(i); |
67 return; | 68 return; |
68 } | 69 } |
69 } | 70 } |
70 | |
71 // We should only get here if we try to remove an event listener that was ne
ver added. | |
72 ASSERT_NOT_REACHED(); | |
73 } | 71 } |
74 | 72 |
75 bool processingUserGesture() | 73 bool processingUserGesture() |
76 { | 74 { |
77 Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); | 75 Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); |
78 return frame && frame->script()->processingUserGesture(); | 76 return frame && frame->script()->processingUserGesture(); |
79 } | 77 } |
80 | 78 |
81 bool shouldAllowNavigation(Frame* frame) | 79 bool shouldAllowNavigation(Frame* frame) |
82 { | 80 { |
(...skipping 14 matching lines...) Expand all Loading... |
97 { | 95 { |
98 Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext(); | 96 Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext(); |
99 if (!callingFrame) | 97 if (!callingFrame) |
100 return; | 98 return; |
101 | 99 |
102 if (!protocolIsJavaScript(url) || ScriptController::isSafeScript(frame)) | 100 if (!protocolIsJavaScript(url) || ScriptController::isSafeScript(frame)) |
103 frame->loader()->scheduleLocationChange(url.string(), callingFrame->load
er()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGestur
e()); | 101 frame->loader()->scheduleLocationChange(url.string(), callingFrame->load
er()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGestur
e()); |
104 } | 102 } |
105 | 103 |
106 } // namespace WebCore | 104 } // namespace WebCore |
OLD | NEW |