Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for jakubkulhan#14 - Buffer events always and check buffer always…
Browse files Browse the repository at this point in the history
… after socket polling.
holgerk committed Jun 22, 2019
1 parent faffd49 commit 00d5e04
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/ChromeDevtoolsProtocol/DevtoolsClient.php
Original file line number Diff line number Diff line change
@@ -111,9 +111,9 @@ public function awaitEvent(ContextInterface $ctx, string $method)
$this->handleMessage($message);
}

if (!empty($this->eventBuffers[$method])) {
return array_shift($this->eventBuffers[$method])->params;
}
if (!empty($this->eventBuffers[$method])) {
return array_shift($this->eventBuffers[$method])->params;
}
}
}

@@ -129,10 +129,10 @@ private function handleMessage($message)
}
}

if (!isset($this->eventBuffers[$message->method])) {
$this->eventBuffers[$message->method] = [];
}
array_push($this->eventBuffers[$message->method], $message);
if (!isset($this->eventBuffers[$message->method])) {
$this->eventBuffers[$message->method] = [];
}
array_push($this->eventBuffers[$message->method], $message);

} else if (isset($message->id)) {
$this->commandResults[$message->id] = $message->result ?? new \stdClass();
14 changes: 7 additions & 7 deletions src/ChromeDevtoolsProtocol/Session.php
Original file line number Diff line number Diff line change
@@ -121,9 +121,9 @@ public function awaitEvent(ContextInterface $ctx, string $method)
$this->handleMessage(json_decode($receivedMessage->message));
}

if (!empty($this->eventBuffers[$method])) {
return array_shift($this->eventBuffers[$method])->params;
}
if (!empty($this->eventBuffers[$method])) {
return array_shift($this->eventBuffers[$method])->params;
}
}
}

@@ -142,10 +142,10 @@ private function handleMessage($message)
}
}

if (!isset($this->eventBuffers[$message->method])) {
$this->eventBuffers[$message->method] = [];
}
array_push($this->eventBuffers[$message->method], $message);
if (!isset($this->eventBuffers[$message->method])) {
$this->eventBuffers[$message->method] = [];
}
array_push($this->eventBuffers[$message->method], $message);

} else if (isset($message->id)) {
$this->commandResults[$message->id] = $message->result ?? new \stdClass();

0 comments on commit 00d5e04

Please sign in to comment.