@@ -126,36 +126,36 @@ void InjectedBundle::setServiceWorkerProxyCreationCallback(void (*callback)(uint
126126void InjectedBundle::postMessage (const String& messageName, API::Object* messageBody)
127127{
128128 auto & webProcess = WebProcess::singleton ();
129- webProcess.parentProcessConnection ()->send (Messages::WebProcessPool::HandleMessage (messageName, UserData (webProcess.transformObjectsToHandles (messageBody))), 0 );
129+ webProcess.protectedParentProcessConnection ()->send (Messages::WebProcessPool::HandleMessage (messageName, UserData (webProcess.transformObjectsToHandles (messageBody))), 0 );
130130}
131131
132132void InjectedBundle::postSynchronousMessage (const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData)
133133{
134134 auto & webProcess = WebProcess::singleton ();
135- auto sendResult = webProcess.parentProcessConnection ()->sendSync (Messages::WebProcessPool::HandleSynchronousMessage (messageName, UserData (webProcess.transformObjectsToHandles (messageBody))), 0 );
135+ auto sendResult = webProcess.protectedParentProcessConnection ()->sendSync (Messages::WebProcessPool::HandleSynchronousMessage (messageName, UserData (webProcess.transformObjectsToHandles (messageBody))), 0 );
136136 if (sendResult.succeeded ()) {
137137 auto [returnUserData] = sendResult.takeReply ();
138- returnData = webProcess.transformHandlesToObjects (returnUserData.object ());
138+ returnData = webProcess.transformHandlesToObjects (returnUserData.protectedObject (). get ());
139139 } else
140140 returnData = nullptr ;
141141}
142142
143143void InjectedBundle::addOriginAccessAllowListEntry (const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains)
144144{
145145 SecurityPolicy::addOriginAccessAllowlistEntry (SecurityOrigin::createFromString (sourceOrigin).get (), destinationProtocol, destinationHost, allowDestinationSubdomains);
146- WebProcess::singleton ().ensureNetworkProcessConnection ().connection (). send (Messages::NetworkConnectionToWebProcess::AddOriginAccessAllowListEntry { sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains }, 0 );
146+ WebProcess::singleton ().ensureNetworkProcessConnection ().protectedConnection ()-> send (Messages::NetworkConnectionToWebProcess::AddOriginAccessAllowListEntry { sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains }, 0 );
147147}
148148
149149void InjectedBundle::removeOriginAccessAllowListEntry (const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains)
150150{
151151 SecurityPolicy::removeOriginAccessAllowlistEntry (SecurityOrigin::createFromString (sourceOrigin).get (), destinationProtocol, destinationHost, allowDestinationSubdomains);
152- WebProcess::singleton ().ensureNetworkProcessConnection ().connection (). send (Messages::NetworkConnectionToWebProcess::RemoveOriginAccessAllowListEntry { sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains }, 0 );
152+ WebProcess::singleton ().ensureNetworkProcessConnection ().protectedConnection ()-> send (Messages::NetworkConnectionToWebProcess::RemoveOriginAccessAllowListEntry { sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains }, 0 );
153153}
154154
155155void InjectedBundle::resetOriginAccessAllowLists ()
156156{
157157 SecurityPolicy::resetOriginAccessAllowlists ();
158- WebProcess::singleton ().ensureNetworkProcessConnection ().connection (). send (Messages::NetworkConnectionToWebProcess::ResetOriginAccessAllowLists { }, 0 );
158+ WebProcess::singleton ().ensureNetworkProcessConnection ().protectedConnection ()-> send (Messages::NetworkConnectionToWebProcess::ResetOriginAccessAllowLists { }, 0 );
159159}
160160
161161void InjectedBundle::setAsynchronousSpellCheckingEnabled (bool enabled)
@@ -167,13 +167,13 @@ void InjectedBundle::setAsynchronousSpellCheckingEnabled(bool enabled)
167167
168168int InjectedBundle::numberOfPages (WebFrame* frame, double pageWidthInPixels, double pageHeightInPixels)
169169{
170- auto * coreFrame = frame ? frame->coreLocalFrame () : nullptr ;
170+ RefPtr coreFrame = frame ? frame->coreLocalFrame () : nullptr ;
171171 if (!coreFrame)
172172 return -1 ;
173173 if (!pageWidthInPixels)
174- pageWidthInPixels = coreFrame->view ()->width ();
174+ pageWidthInPixels = coreFrame->protectedView ()->width ();
175175 if (!pageHeightInPixels)
176- pageHeightInPixels = coreFrame->view ()->height ();
176+ pageHeightInPixels = coreFrame->protectedView ()->height ();
177177
178178 return PrintContext::numberOfPages (*coreFrame, FloatSize (pageWidthInPixels, pageHeightInPixels));
179179}
@@ -184,34 +184,34 @@ int InjectedBundle::pageNumberForElementById(WebFrame* frame, const String& id,
184184 if (!coreFrame)
185185 return -1 ;
186186
187- RefPtr element = coreFrame->document ()->getElementById (id);
187+ RefPtr element = coreFrame->protectedDocument ()->getElementById (id);
188188 if (!element)
189189 return -1 ;
190190
191191 if (!pageWidthInPixels)
192- pageWidthInPixels = coreFrame->view ()->width ();
192+ pageWidthInPixels = coreFrame->protectedView ()->width ();
193193 if (!pageHeightInPixels)
194- pageHeightInPixels = coreFrame->view ()->height ();
194+ pageHeightInPixels = coreFrame->protectedView ()->height ();
195195
196196 return PrintContext::pageNumberForElement (element.get (), FloatSize (pageWidthInPixels, pageHeightInPixels));
197197}
198198
199199String InjectedBundle::pageSizeAndMarginsInPixels (WebFrame* frame, int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft)
200200{
201- auto * coreFrame = frame ? frame->coreLocalFrame () : nullptr ;
201+ RefPtr coreFrame = frame ? frame->coreLocalFrame () : nullptr ;
202202 if (!coreFrame)
203203 return String ();
204204
205- return PrintContext::pageSizeAndMarginsInPixels (coreFrame, pageIndex, width, height, marginTop, marginRight, marginBottom, marginLeft);
205+ return PrintContext::pageSizeAndMarginsInPixels (coreFrame. get () , pageIndex, width, height, marginTop, marginRight, marginBottom, marginLeft);
206206}
207207
208208bool InjectedBundle::isPageBoxVisible (WebFrame* frame, int pageIndex)
209209{
210- auto * coreFrame = frame ? frame->coreLocalFrame () : nullptr ;
210+ RefPtr coreFrame = frame ? frame->coreLocalFrame () : nullptr ;
211211 if (!coreFrame)
212212 return false ;
213213
214- return PrintContext::isPageBoxVisible (coreFrame, pageIndex);
214+ return PrintContext::isPageBoxVisible (coreFrame. get () , pageIndex);
215215}
216216
217217bool InjectedBundle::isProcessingUserGesture ()
@@ -276,7 +276,7 @@ void InjectedBundle::setUserStyleSheetLocation(const String& location)
276276void InjectedBundle::removeAllWebNotificationPermissions (WebPage* page)
277277{
278278#if ENABLE(NOTIFICATIONS)
279- page->notificationPermissionRequestManager ()->removeAllPermissionsForTesting ();
279+ page->protectedNotificationPermissionRequestManager ()->removeAllPermissionsForTesting ();
280280#else
281281 UNUSED_PARAM (page);
282282#endif
@@ -285,7 +285,7 @@ void InjectedBundle::removeAllWebNotificationPermissions(WebPage* page)
285285std::optional<WTF::UUID> InjectedBundle::webNotificationID (JSContextRef jsContext, JSValueRef jsNotification)
286286{
287287#if ENABLE(NOTIFICATIONS)
288- WebCore::Notification* notification = JSNotification::toWrapped (toJS (jsContext)->vm (), toJS (toJS (jsContext), jsNotification));
288+ RefPtr notification = JSNotification::toWrapped (toJS (jsContext)->vm (), toJS (toJS (jsContext), jsNotification));
289289 if (!notification)
290290 return std::nullopt ;
291291 return notification->identifier ();
@@ -314,11 +314,11 @@ InjectedBundle::DocumentIDToURLMap InjectedBundle::liveDocumentURLs(bool exclude
314314
315315 if (excludeDocumentsInPageGroupPages) {
316316 Page::forEachPage ([&](Page& page) {
317- for (auto * frame = &page.mainFrame (); frame; frame = frame->tree ().traverseNext ()) {
318- auto * localFrame = dynamicDowncast<LocalFrame>(frame);
317+ for (RefPtr frame = &page.mainFrame (); frame; frame = frame->tree ().traverseNext ()) {
318+ RefPtr localFrame = dynamicDowncast<LocalFrame>(frame);
319319 if (!localFrame)
320320 continue ;
321- auto * document = localFrame->document ();
321+ RefPtr document = localFrame->document ();
322322 if (!document)
323323 continue ;
324324 result.remove (document->identifier ().object ());
0 commit comments